typeson-registry 2.0.0 → 3.0.0
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 +88 -72
- 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.js +73 -68
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/presets/array-nonindex-keys.umd.js.map +1 -1
- package/dist/presets/builtin.umd.js +1 -1
- package/dist/presets/builtin.umd.js.map +1 -1
- package/dist/presets/postmessage.umd.js +1 -1
- package/dist/presets/postmessage.umd.js.map +1 -1
- package/dist/presets/socketio.umd.js +1 -1
- package/dist/presets/socketio.umd.js.map +1 -1
- package/dist/presets/sparse-undefined.umd.js.map +1 -1
- package/dist/presets/special-numbers.umd.js.map +1 -1
- package/dist/presets/structured-cloning-throwing.umd.js +1 -1
- package/dist/presets/structured-cloning-throwing.umd.js.map +1 -1
- package/dist/presets/structured-cloning.umd.js +1 -1
- package/dist/presets/structured-cloning.umd.js.map +1 -1
- package/dist/presets/undef.umd.js.map +1 -1
- package/dist/presets/universal.umd.js +1 -1
- package/dist/presets/universal.umd.js.map +1 -1
- package/dist/types/arraybuffer.umd.js.map +1 -1
- package/dist/types/bigint-object.umd.js +1 -1
- package/dist/types/bigint-object.umd.js.map +1 -1
- package/dist/types/bigint.umd.js +1 -1
- package/dist/types/bigint.umd.js.map +1 -1
- package/dist/types/blob.umd.js.map +1 -1
- package/dist/types/cloneable.umd.js.map +1 -1
- package/dist/types/cryptokey.umd.js.map +1 -1
- package/dist/types/dataview.umd.js.map +1 -1
- package/dist/types/date.umd.js.map +1 -1
- package/dist/types/error.umd.js.map +1 -1
- package/dist/types/errors.umd.js +1 -1
- package/dist/types/errors.umd.js.map +1 -1
- package/dist/types/file.umd.js.map +1 -1
- package/dist/types/filelist.umd.js.map +1 -1
- package/dist/types/imagebitmap.umd.js.map +1 -1
- package/dist/types/imagedata.umd.js.map +1 -1
- package/dist/types/infinity.umd.js.map +1 -1
- package/dist/types/intl-types.umd.js.map +1 -1
- package/dist/types/map.umd.js.map +1 -1
- package/dist/types/nan.umd.js.map +1 -1
- package/dist/types/negative-infinity.umd.js.map +1 -1
- package/dist/types/nonbuiltin-ignore.umd.js.map +1 -1
- package/dist/types/primitive-objects.umd.js +1 -1
- package/dist/types/primitive-objects.umd.js.map +1 -1
- package/dist/types/regexp.umd.js.map +1 -1
- package/dist/types/resurrectable.umd.js.map +1 -1
- package/dist/types/set.umd.js.map +1 -1
- package/dist/types/typed-arrays-socketio.umd.js +1 -1
- package/dist/types/typed-arrays-socketio.umd.js.map +1 -1
- package/dist/types/typed-arrays.umd.js +1 -1
- package/dist/types/typed-arrays.umd.js.map +1 -1
- package/dist/types/undef.umd.js.map +1 -1
- package/dist/types/user-object.umd.js.map +1 -1
- package/package.json +20 -20
- package/polyfills/createObjectURL.js +3 -3
- package/polyfills/createObjectURL.umd.js +1 -1
- package/polyfills/createObjectURL.umd.js.map +1 -1
package/dist/index.js
CHANGED
|
@@ -119,7 +119,7 @@ const bigintObject = {
|
|
|
119
119
|
test (x) {
|
|
120
120
|
return typeof x === 'object' && hasConstructorOf(x, BigInt);
|
|
121
121
|
},
|
|
122
|
-
replace
|
|
122
|
+
replace: String,
|
|
123
123
|
revive (s) {
|
|
124
124
|
// Filed this to avoid error: https://github.com/eslint/eslint/issues/11810
|
|
125
125
|
// eslint-disable-next-line no-new-object
|
|
@@ -135,8 +135,8 @@ const bigint = {
|
|
|
135
135
|
test (x) {
|
|
136
136
|
return typeof x === 'bigint';
|
|
137
137
|
},
|
|
138
|
-
replace
|
|
139
|
-
revive
|
|
138
|
+
replace: String,
|
|
139
|
+
revive: BigInt
|
|
140
140
|
}
|
|
141
141
|
};
|
|
142
142
|
|
|
@@ -408,31 +408,34 @@ const error = {
|
|
|
408
408
|
}
|
|
409
409
|
};
|
|
410
410
|
|
|
411
|
-
/*
|
|
412
|
-
|
|
413
|
-
/* c8 ignore next */
|
|
414
|
-
const _global$2 = typeof self === 'undefined' ? global : self;
|
|
411
|
+
/* globals InternalError */
|
|
415
412
|
|
|
416
413
|
const errors = {};
|
|
417
|
-
|
|
414
|
+
|
|
415
|
+
// JS standard
|
|
418
416
|
[
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
417
|
+
TypeError, RangeError, SyntaxError, ReferenceError, EvalError, URIError
|
|
418
|
+
].forEach((error) => create$2(error));
|
|
419
|
+
|
|
420
|
+
/* c8 ignore next 2 */
|
|
421
|
+
// @ts-ignore Non-standard
|
|
422
|
+
typeof InternalError === 'function' && create$2(InternalError);
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* Comprises all built-in errors.
|
|
426
|
+
* @param {
|
|
427
|
+
* TypeError|RangeError|SyntaxError|ReferenceError|EvalError|URIError|
|
|
428
|
+
* InternalError
|
|
429
|
+
* } Ctor
|
|
430
|
+
* @returns {void}
|
|
431
|
+
*/
|
|
432
|
+
function create$2 (Ctor) {
|
|
433
|
+
errors[Ctor.name.toLowerCase()] = {
|
|
434
|
+
test (x) { return hasConstructorOf(x, Ctor); },
|
|
435
|
+
replace (e) { return e.message; },
|
|
436
|
+
revive (message) { return new Ctor(message); }
|
|
437
|
+
};
|
|
438
|
+
}
|
|
436
439
|
|
|
437
440
|
/* globals XMLHttpRequest, File, FileReader */
|
|
438
441
|
|
|
@@ -710,7 +713,7 @@ const primitiveObjects = {
|
|
|
710
713
|
test (x) {
|
|
711
714
|
return toStringTag(x) === 'String' && typeof x === 'object';
|
|
712
715
|
},
|
|
713
|
-
replace
|
|
716
|
+
replace: String, // convert to primitive string
|
|
714
717
|
revive (s) { return new String(s); } // Revive to an objectified string
|
|
715
718
|
},
|
|
716
719
|
// Boolean Object (not primitive boolean which need no type spec)
|
|
@@ -719,7 +722,7 @@ const primitiveObjects = {
|
|
|
719
722
|
return toStringTag(x) === 'Boolean' &&
|
|
720
723
|
typeof x === 'object';
|
|
721
724
|
},
|
|
722
|
-
replace
|
|
725
|
+
replace: Boolean, // convert to primitive boolean
|
|
723
726
|
revive (b) {
|
|
724
727
|
// Revive to an objectified Boolean
|
|
725
728
|
return new Boolean(b);
|
|
@@ -730,7 +733,7 @@ const primitiveObjects = {
|
|
|
730
733
|
test (x) {
|
|
731
734
|
return toStringTag(x) === 'Number' && typeof x === 'object';
|
|
732
735
|
},
|
|
733
|
-
replace
|
|
736
|
+
replace: Number, // convert to primitive number
|
|
734
737
|
revive (n) { return new Number(n); } // Revive to an objectified number
|
|
735
738
|
}
|
|
736
739
|
};
|
|
@@ -786,30 +789,20 @@ const set = {
|
|
|
786
789
|
|
|
787
790
|
/* eslint-env browser, node */
|
|
788
791
|
|
|
789
|
-
/* c8 ignore next */
|
|
790
|
-
const _global$1 = typeof self === 'undefined' ? global : self;
|
|
791
|
-
|
|
792
792
|
// Support all kinds of typed arrays (views of ArrayBuffers)
|
|
793
793
|
const typedArraysSocketIO = {};
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
].forEach(function (typeName) {
|
|
805
|
-
const arrType = typeName;
|
|
806
|
-
const TypedArray = _global$1[typeName];
|
|
807
|
-
/* c8 ignore next 3 */
|
|
808
|
-
if (!TypedArray) {
|
|
809
|
-
return;
|
|
810
|
-
}
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* @param {
|
|
797
|
+
* Int8Array|Uint8Array|Uint8ClampedArray|Int16Array|Uint16Array|Int32Array|
|
|
798
|
+
* Uint32Array|Float32Array|Float64Array
|
|
799
|
+
* } TypedArray
|
|
800
|
+
* @returns {void}
|
|
801
|
+
*/
|
|
802
|
+
function create$1 (TypedArray) {
|
|
803
|
+
const typeName = TypedArray.name;
|
|
811
804
|
typedArraysSocketIO[typeName.toLowerCase()] = {
|
|
812
|
-
test (x) { return toStringTag(x) ===
|
|
805
|
+
test (x) { return toStringTag(x) === typeName; },
|
|
813
806
|
replace (a) {
|
|
814
807
|
return (a.byteOffset === 0 &&
|
|
815
808
|
a.byteLength === a.buffer.byteLength
|
|
@@ -832,33 +825,40 @@ const typedArraysSocketIO = {};
|
|
|
832
825
|
: buf;
|
|
833
826
|
}
|
|
834
827
|
};
|
|
835
|
-
}
|
|
828
|
+
}
|
|
836
829
|
|
|
837
|
-
|
|
830
|
+
if (typeof Int8Array === 'function') {
|
|
831
|
+
// Those constructors are added in ES6 as a group.
|
|
832
|
+
// If we have Int8Array, we can assume the rest also exists.
|
|
833
|
+
|
|
834
|
+
[
|
|
835
|
+
Int8Array,
|
|
836
|
+
Uint8Array,
|
|
837
|
+
Uint8ClampedArray,
|
|
838
|
+
Int16Array,
|
|
839
|
+
Uint16Array,
|
|
840
|
+
Int32Array,
|
|
841
|
+
Uint32Array,
|
|
842
|
+
Float32Array,
|
|
843
|
+
Float64Array
|
|
844
|
+
].forEach((TypedArray) => create$1(TypedArray));
|
|
845
|
+
}
|
|
838
846
|
|
|
839
|
-
/*
|
|
840
|
-
const _global = typeof self === 'undefined' ? global : self;
|
|
847
|
+
/* eslint-env browser, node */
|
|
841
848
|
|
|
842
849
|
const typedArrays = {};
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
].forEach(function (typeName) {
|
|
854
|
-
const arrType = typeName;
|
|
855
|
-
const TypedArray = _global[arrType];
|
|
856
|
-
/* c8 ignore next 3 */
|
|
857
|
-
if (!TypedArray) {
|
|
858
|
-
return;
|
|
859
|
-
}
|
|
850
|
+
|
|
851
|
+
/**
|
|
852
|
+
* @param {
|
|
853
|
+
* Int8Array|Uint8Array|Uint8ClampedArray|Int16Array|Uint16Array|Int32Array|
|
|
854
|
+
* Uint32Array|Float32Array|Float64Array
|
|
855
|
+
* } TypedArray
|
|
856
|
+
* @returns {void}
|
|
857
|
+
*/
|
|
858
|
+
function create (TypedArray) {
|
|
859
|
+
const typeName = TypedArray.name;
|
|
860
860
|
typedArrays[typeName.toLowerCase()] = {
|
|
861
|
-
test (x) { return toStringTag(x) ===
|
|
861
|
+
test (x) { return toStringTag(x) === typeName; },
|
|
862
862
|
replace ({buffer, byteOffset, length: l}, stateObj) {
|
|
863
863
|
if (!stateObj.buffers) {
|
|
864
864
|
stateObj.buffers = [];
|
|
@@ -889,7 +889,23 @@ const typedArrays = {};
|
|
|
889
889
|
return new TypedArray(buffer, byteOffset, len);
|
|
890
890
|
}
|
|
891
891
|
};
|
|
892
|
-
}
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
if (typeof Int8Array === 'function') {
|
|
895
|
+
// Those constructors are added in ES6 as a group.
|
|
896
|
+
// If we have Int8Array, we can assume the rest also exists.
|
|
897
|
+
[
|
|
898
|
+
Int8Array,
|
|
899
|
+
Uint8Array,
|
|
900
|
+
Uint8ClampedArray,
|
|
901
|
+
Int16Array,
|
|
902
|
+
Uint16Array,
|
|
903
|
+
Int32Array,
|
|
904
|
+
Uint32Array,
|
|
905
|
+
Float32Array,
|
|
906
|
+
Float64Array
|
|
907
|
+
].forEach((TypedArray) => create(TypedArray));
|
|
908
|
+
}
|
|
893
909
|
|
|
894
910
|
// This does not preserve `undefined` in sparse arrays; see the `undef`
|
|
895
911
|
|