typeson-registry 14.2.0 → 14.2.2
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 +63 -3
- 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 +58 -4
- 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/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.d.ts.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/dist/index.umd.cjs
CHANGED
|
@@ -2423,11 +2423,51 @@
|
|
|
2423
2423
|
test: function test(x) {
|
|
2424
2424
|
return toStringTag(x) === 'Number' && _typeof(x) === 'object';
|
|
2425
2425
|
},
|
|
2426
|
-
replace
|
|
2427
|
-
//
|
|
2426
|
+
// `_encapsulate`'s nested-replace guard (`_stateObj.replaced`)
|
|
2427
|
+
// means a bare `NaN`/`Infinity`/`-Infinity`/`-0` returned here
|
|
2428
|
+
// would skip the sentinel treatment the bare `nan`/`infinity`/
|
|
2429
|
+
// `negativeZero` type specs normally give those values (since
|
|
2430
|
+
// we're already inside this spec's own `replace()`) -- JSON
|
|
2431
|
+
// can't represent them, so they'd otherwise silently become
|
|
2432
|
+
// `null` (or lose their sign, for `-0`). Encode them the same
|
|
2433
|
+
// way those specs do, directly, rather than relying on that
|
|
2434
|
+
// nested pass.
|
|
2435
|
+
replace: function replace(o) {
|
|
2436
|
+
var n = o.valueOf();
|
|
2437
|
+
if (Number.isNaN(n)) {
|
|
2438
|
+
return 'NaN';
|
|
2439
|
+
}
|
|
2440
|
+
if (n === Infinity) {
|
|
2441
|
+
return 'Infinity';
|
|
2442
|
+
}
|
|
2443
|
+
if (n === -Infinity) {
|
|
2444
|
+
return '-Infinity';
|
|
2445
|
+
}
|
|
2446
|
+
if (Object.is(n, -0)) {
|
|
2447
|
+
// A plain `0` here would be indistinguishable from a
|
|
2448
|
+
// genuine positive `0` once round-tripped through JSON
|
|
2449
|
+
// (which can't represent the sign), so this needs its
|
|
2450
|
+
// own sentinel too, same as the others above.
|
|
2451
|
+
return '-0';
|
|
2452
|
+
}
|
|
2453
|
+
return n;
|
|
2454
|
+
},
|
|
2455
|
+
// Revive to an objectified number
|
|
2428
2456
|
revive: function revive(n) {
|
|
2457
|
+
if (n === 'NaN') {
|
|
2458
|
+
return new Number(NaN);
|
|
2459
|
+
}
|
|
2460
|
+
if (n === 'Infinity') {
|
|
2461
|
+
return new Number(Infinity);
|
|
2462
|
+
}
|
|
2463
|
+
if (n === '-Infinity') {
|
|
2464
|
+
return new Number(-Infinity);
|
|
2465
|
+
}
|
|
2466
|
+
if (n === '-0') {
|
|
2467
|
+
return new Number(-0);
|
|
2468
|
+
}
|
|
2429
2469
|
return new Number(n);
|
|
2430
|
-
}
|
|
2470
|
+
}
|
|
2431
2471
|
}
|
|
2432
2472
|
};
|
|
2433
2473
|
|
|
@@ -3185,7 +3225,21 @@
|
|
|
3185
3225
|
// HTML-SPECIFIC
|
|
3186
3226
|
'Event',
|
|
3187
3227
|
// Also in Node `worker_threads` (currently experimental)
|
|
3188
|
-
'MessageChannel'].includes(stringTag) ||
|
|
3228
|
+
'MessageChannel', 'MessagePort'].includes(stringTag) ||
|
|
3229
|
+
// Node's native `worker_threads` `MessageChannel`/
|
|
3230
|
+
// `MessagePort` don't set `Symbol.toStringTag` per
|
|
3231
|
+
// https://github.com/nodejs/node/issues/65527
|
|
3232
|
+
// (verified directly:
|
|
3233
|
+
// `{}.toString.call(new MessageChannel())` is
|
|
3234
|
+
// `"[object Object]"`, and `.port1`'s is
|
|
3235
|
+
// `"[object EventTarget]"`, its own base class), so the
|
|
3236
|
+
// `stringTag` check above can't catch them there; a real
|
|
3237
|
+
// browser's `MessagePort`/`MessageChannel` already match
|
|
3238
|
+
// via `stringTag` (or, for `MessagePort`, would need its
|
|
3239
|
+
// own `stringTag` entry if ever seen failing to match) --
|
|
3240
|
+
// this is purely a fallback for environments (like Node)
|
|
3241
|
+
// that don't set the tag.
|
|
3242
|
+
val && val.constructor && ['MessageChannel', 'MessagePort'].includes(val.constructor.name) ||
|
|
3189
3243
|
// 1. `IsDetachedBuffer` (a process not called within the
|
|
3190
3244
|
// ECMAScript spec)
|
|
3191
3245
|
['ArrayBuffer', 'DataView', 'Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array', 'BigInt64Array', 'BigUint64Array'].includes(stringTag) && isBufferDetached(val) || (
|