typeson-registry 14.1.0 → 14.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +45 -2
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/index.umd.cjs +43 -3
- package/dist/index.umd.cjs.map +1 -1
- package/dist/index.umd.min.cjs +1 -1
- package/dist/index.umd.min.cjs.map +1 -1
- package/dist/polyfills/SyncBlobFile.d.ts +33 -0
- package/dist/polyfills/SyncBlobFile.d.ts.map +1 -0
- package/dist/polyfills/URL.d.ts +23 -0
- package/dist/polyfills/URL.d.ts.map +1 -1
- package/dist/polyfills/index.d.ts +1 -0
- package/dist/presets/builtin.umd.cjs +1 -1
- package/dist/presets/builtin.umd.cjs.map +1 -1
- package/dist/presets/socketio.umd.cjs +1 -1
- package/dist/presets/socketio.umd.cjs.map +1 -1
- package/dist/presets/structured-cloning-throwing.umd.cjs +1 -1
- package/dist/presets/structured-cloning-throwing.umd.cjs.map +1 -1
- package/dist/presets/structured-cloning.umd.cjs +1 -1
- package/dist/presets/structured-cloning.umd.cjs.map +1 -1
- package/dist/presets/universal.umd.cjs +1 -1
- package/dist/presets/universal.umd.cjs.map +1 -1
- package/dist/types/primitive-objects.d.ts.map +1 -1
- package/dist/types/primitive-objects.umd.cjs +1 -1
- package/dist/types/primitive-objects.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/polyfills/SyncBlobFile.js +97 -0
- package/polyfills/URL.js +44 -3
- package/polyfills/index.cjs +153 -2
- package/polyfills/index.cjs.map +1 -1
- package/polyfills/index.js +1 -0
package/dist/index.js
CHANGED
|
@@ -1312,8 +1312,51 @@ const primitiveObjects = {
|
|
|
1312
1312
|
test (x) {
|
|
1313
1313
|
return toStringTag(x) === 'Number' && typeof x === 'object';
|
|
1314
1314
|
},
|
|
1315
|
-
|
|
1316
|
-
|
|
1315
|
+
// `_encapsulate`'s nested-replace guard (`_stateObj.replaced`)
|
|
1316
|
+
// means a bare `NaN`/`Infinity`/`-Infinity`/`-0` returned here
|
|
1317
|
+
// would skip the sentinel treatment the bare `nan`/`infinity`/
|
|
1318
|
+
// `negativeZero` type specs normally give those values (since
|
|
1319
|
+
// we're already inside this spec's own `replace()`) -- JSON
|
|
1320
|
+
// can't represent them, so they'd otherwise silently become
|
|
1321
|
+
// `null` (or lose their sign, for `-0`). Encode them the same
|
|
1322
|
+
// way those specs do, directly, rather than relying on that
|
|
1323
|
+
// nested pass.
|
|
1324
|
+
replace (o) {
|
|
1325
|
+
const n = o.valueOf();
|
|
1326
|
+
if (Number.isNaN(n)) {
|
|
1327
|
+
return 'NaN';
|
|
1328
|
+
}
|
|
1329
|
+
if (n === Infinity) {
|
|
1330
|
+
return 'Infinity';
|
|
1331
|
+
}
|
|
1332
|
+
if (n === -Infinity) {
|
|
1333
|
+
return '-Infinity';
|
|
1334
|
+
}
|
|
1335
|
+
if (Object.is(n, -0)) {
|
|
1336
|
+
// A plain `0` here would be indistinguishable from a
|
|
1337
|
+
// genuine positive `0` once round-tripped through JSON
|
|
1338
|
+
// (which can't represent the sign), so this needs its
|
|
1339
|
+
// own sentinel too, same as the others above.
|
|
1340
|
+
return '-0';
|
|
1341
|
+
}
|
|
1342
|
+
return n;
|
|
1343
|
+
},
|
|
1344
|
+
// Revive to an objectified number
|
|
1345
|
+
revive (n) {
|
|
1346
|
+
if (n === 'NaN') {
|
|
1347
|
+
return new Number(NaN);
|
|
1348
|
+
}
|
|
1349
|
+
if (n === 'Infinity') {
|
|
1350
|
+
return new Number(Infinity);
|
|
1351
|
+
}
|
|
1352
|
+
if (n === '-Infinity') {
|
|
1353
|
+
return new Number(-Infinity);
|
|
1354
|
+
}
|
|
1355
|
+
if (n === '-0') {
|
|
1356
|
+
return new Number(-0);
|
|
1357
|
+
}
|
|
1358
|
+
return new Number(n);
|
|
1359
|
+
}
|
|
1317
1360
|
}
|
|
1318
1361
|
};
|
|
1319
1362
|
|