@quilted/threads
Advanced tools
Comparing version 0.0.0-preview-20230401011453 to 0.0.0-preview-20230526050018
# @quilted/threads | ||
## 0.0.0-preview-20230401011453 | ||
## 0.0.0-preview-20230526050018 | ||
### Patch Changes | ||
- Update to TypeScript 5.0 | ||
- Encode more native JS types | ||
- Updated dependencies []: | ||
- @quilted/events@0.0.0-preview-20230401011453 | ||
## 0.1.15 | ||
### Patch Changes | ||
- [`54e3db19`](https://github.com/lemonmade/quilt/commit/54e3db19094207d5eb5a073cfdbe98cb9ca68372) Thanks [@lemonmade](https://github.com/lemonmade)! - Encode more native JS types | ||
## 0.1.14 | ||
@@ -13,0 +16,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"type": "module", | ||
"version": "0.0.0-preview-20230401011453", | ||
"version": "0.0.0-preview-20230526050018", | ||
"license": "MIT", | ||
@@ -32,3 +32,3 @@ "engines": { | ||
"dependencies": { | ||
"@quilted/events": "0.0.0-preview-20230401011453" | ||
"@quilted/events": "^0.1.0" | ||
}, | ||
@@ -35,0 +35,0 @@ "devDependencies": { |
@@ -21,2 +21,6 @@ import { | ||
const FUNCTION = '_@f'; | ||
const MAP = '_@m'; | ||
const SET = '_@s'; | ||
const DATE = '_@d'; | ||
const REGEXP = '_@r'; | ||
const ASYNC_ITERATOR = '_@i'; | ||
@@ -131,3 +135,3 @@ | ||
return [result, transferables]; | ||
return fullResult; | ||
} | ||
@@ -139,6 +143,37 @@ | ||
seen.set(value, fullResult); | ||
return fullResult; | ||
} | ||
if (value instanceof RegExp) { | ||
const result = [{[REGEXP]: [value.source, value.flags]}]; | ||
const fullResult: EncodeResult = [result, transferables]; | ||
seen.set(value, fullResult); | ||
return fullResult; | ||
} | ||
if (value instanceof Date) { | ||
const result = [{[DATE]: value.toISOString()}]; | ||
const fullResult: EncodeResult = [result, transferables]; | ||
seen.set(value, fullResult); | ||
return fullResult; | ||
} | ||
if (value instanceof Map) { | ||
const entries = [...value.entries()].map(([key, value]) => { | ||
return [encodeValue(key), encodeValue(value)]; | ||
}); | ||
const result = [{[MAP]: entries}]; | ||
const fullResult: EncodeResult = [result, transferables]; | ||
seen.set(value, fullResult); | ||
return fullResult; | ||
} | ||
if (value instanceof Set) { | ||
const entries = [...value].map((entry) => encodeValue(entry)); | ||
const result = [{[SET]: entries}]; | ||
const fullResult: EncodeResult = [result, transferables]; | ||
seen.set(value, fullResult); | ||
return fullResult; | ||
} | ||
const valueIsIterator = isIterator(value); | ||
@@ -209,2 +244,27 @@ | ||
if (REGEXP in value) { | ||
return new RegExp(...(value as {[REGEXP]: [string, string]})[REGEXP]); | ||
} | ||
if (DATE in value) { | ||
return new Date((value as {[DATE]: string})[DATE]); | ||
} | ||
if (MAP in value) { | ||
return new Map( | ||
(value as {[MAP]: [any, any]})[MAP].map(([key, value]) => [ | ||
decode(key, retainedBy), | ||
decode(value, retainedBy), | ||
]), | ||
); | ||
} | ||
if (SET in value) { | ||
return new Set( | ||
(value as {[SET]: any[]})[SET].map((entry) => | ||
decode(entry, retainedBy), | ||
), | ||
); | ||
} | ||
if (FUNCTION in value) { | ||
@@ -211,0 +271,0 @@ const id = (value as {[FUNCTION]: string})[FUNCTION]; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
174203
3129
+ Added@quilted/events@0.1.18(transitive)
- Removed@quilted/events@0.0.0-preview-20230401011453(transitive)
Updated@quilted/events@^0.1.0