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.
Files changed (62) hide show
  1. package/dist/index.js +88 -72
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.min.js +1 -1
  4. package/dist/index.min.js.map +1 -1
  5. package/dist/index.umd.js +73 -68
  6. package/dist/index.umd.js.map +1 -1
  7. package/dist/index.umd.min.js +1 -1
  8. package/dist/index.umd.min.js.map +1 -1
  9. package/dist/presets/array-nonindex-keys.umd.js.map +1 -1
  10. package/dist/presets/builtin.umd.js +1 -1
  11. package/dist/presets/builtin.umd.js.map +1 -1
  12. package/dist/presets/postmessage.umd.js +1 -1
  13. package/dist/presets/postmessage.umd.js.map +1 -1
  14. package/dist/presets/socketio.umd.js +1 -1
  15. package/dist/presets/socketio.umd.js.map +1 -1
  16. package/dist/presets/sparse-undefined.umd.js.map +1 -1
  17. package/dist/presets/special-numbers.umd.js.map +1 -1
  18. package/dist/presets/structured-cloning-throwing.umd.js +1 -1
  19. package/dist/presets/structured-cloning-throwing.umd.js.map +1 -1
  20. package/dist/presets/structured-cloning.umd.js +1 -1
  21. package/dist/presets/structured-cloning.umd.js.map +1 -1
  22. package/dist/presets/undef.umd.js.map +1 -1
  23. package/dist/presets/universal.umd.js +1 -1
  24. package/dist/presets/universal.umd.js.map +1 -1
  25. package/dist/types/arraybuffer.umd.js.map +1 -1
  26. package/dist/types/bigint-object.umd.js +1 -1
  27. package/dist/types/bigint-object.umd.js.map +1 -1
  28. package/dist/types/bigint.umd.js +1 -1
  29. package/dist/types/bigint.umd.js.map +1 -1
  30. package/dist/types/blob.umd.js.map +1 -1
  31. package/dist/types/cloneable.umd.js.map +1 -1
  32. package/dist/types/cryptokey.umd.js.map +1 -1
  33. package/dist/types/dataview.umd.js.map +1 -1
  34. package/dist/types/date.umd.js.map +1 -1
  35. package/dist/types/error.umd.js.map +1 -1
  36. package/dist/types/errors.umd.js +1 -1
  37. package/dist/types/errors.umd.js.map +1 -1
  38. package/dist/types/file.umd.js.map +1 -1
  39. package/dist/types/filelist.umd.js.map +1 -1
  40. package/dist/types/imagebitmap.umd.js.map +1 -1
  41. package/dist/types/imagedata.umd.js.map +1 -1
  42. package/dist/types/infinity.umd.js.map +1 -1
  43. package/dist/types/intl-types.umd.js.map +1 -1
  44. package/dist/types/map.umd.js.map +1 -1
  45. package/dist/types/nan.umd.js.map +1 -1
  46. package/dist/types/negative-infinity.umd.js.map +1 -1
  47. package/dist/types/nonbuiltin-ignore.umd.js.map +1 -1
  48. package/dist/types/primitive-objects.umd.js +1 -1
  49. package/dist/types/primitive-objects.umd.js.map +1 -1
  50. package/dist/types/regexp.umd.js.map +1 -1
  51. package/dist/types/resurrectable.umd.js.map +1 -1
  52. package/dist/types/set.umd.js.map +1 -1
  53. package/dist/types/typed-arrays-socketio.umd.js +1 -1
  54. package/dist/types/typed-arrays-socketio.umd.js.map +1 -1
  55. package/dist/types/typed-arrays.umd.js +1 -1
  56. package/dist/types/typed-arrays.umd.js.map +1 -1
  57. package/dist/types/undef.umd.js.map +1 -1
  58. package/dist/types/user-object.umd.js.map +1 -1
  59. package/package.json +20 -20
  60. package/polyfills/createObjectURL.js +3 -3
  61. package/polyfills/createObjectURL.umd.js +1 -1
  62. package/polyfills/createObjectURL.umd.js.map +1 -1
package/dist/index.umd.js CHANGED
@@ -1042,9 +1042,7 @@
1042
1042
  test: function test(x) {
1043
1043
  return _typeof$1(x) === 'object' && hasConstructorOf(x, BigInt);
1044
1044
  },
1045
- replace: function replace(n) {
1046
- return String(n);
1047
- },
1045
+ replace: String,
1048
1046
  revive: function revive(s) {
1049
1047
  // Filed this to avoid error: https://github.com/eslint/eslint/issues/11810
1050
1048
  // eslint-disable-next-line no-new-object
@@ -1059,12 +1057,8 @@
1059
1057
  test: function test(x) {
1060
1058
  return typeof x === 'bigint';
1061
1059
  },
1062
- replace: function replace(n) {
1063
- return String(n);
1064
- },
1065
- revive: function revive(s) {
1066
- return BigInt(s);
1067
- }
1060
+ replace: String,
1061
+ revive: BigInt
1068
1062
  }
1069
1063
  };
1070
1064
 
@@ -1404,31 +1398,38 @@
1404
1398
  }
1405
1399
  }; // See also errors.js that may be registered after having registered this type.
1406
1400
 
1407
- /* eslint-env browser, node */
1408
- /* c8 ignore next */
1409
-
1410
- var _global$2 = typeof self === 'undefined' ? global : self;
1401
+ /* globals InternalError */
1402
+ var errors = {}; // JS standard
1411
1403
 
1412
- var errors = {}; // Comprises all built-in errors.
1404
+ [TypeError, RangeError, SyntaxError, ReferenceError, EvalError, URIError].forEach(function (error) {
1405
+ return create$2(error);
1406
+ });
1407
+ /* c8 ignore next 2 */
1408
+ // @ts-ignore Non-standard
1413
1409
 
1414
- ['TypeError', 'RangeError', 'SyntaxError', 'ReferenceError', 'EvalError', 'URIError', 'InternalError' // non-standard
1415
- ].forEach(function (errName) {
1416
- var Cnstrctr = _global$2[errName];
1410
+ typeof InternalError === 'function' && create$2(InternalError);
1411
+ /**
1412
+ * Comprises all built-in errors.
1413
+ * @param {
1414
+ * TypeError|RangeError|SyntaxError|ReferenceError|EvalError|URIError|
1415
+ * InternalError
1416
+ * } Ctor
1417
+ * @returns {void}
1418
+ */
1417
1419
 
1418
- if (Cnstrctr) {
1419
- errors[errName.toLowerCase()] = {
1420
- test: function test(x) {
1421
- return hasConstructorOf(x, Cnstrctr);
1422
- },
1423
- replace: function replace(e) {
1424
- return e.message;
1425
- },
1426
- revive: function revive(message) {
1427
- return new Cnstrctr(message);
1428
- }
1429
- };
1430
- }
1431
- });
1420
+ function create$2(Ctor) {
1421
+ errors[Ctor.name.toLowerCase()] = {
1422
+ test: function test(x) {
1423
+ return hasConstructorOf(x, Ctor);
1424
+ },
1425
+ replace: function replace(e) {
1426
+ return e.message;
1427
+ },
1428
+ revive: function revive(message) {
1429
+ return new Ctor(message);
1430
+ }
1431
+ };
1432
+ }
1432
1433
 
1433
1434
  /* globals XMLHttpRequest, File, FileReader */
1434
1435
  var file = {
@@ -1749,9 +1750,7 @@
1749
1750
  test: function test(x) {
1750
1751
  return toStringTag(x) === 'String' && _typeof$1(x) === 'object';
1751
1752
  },
1752
- replace: function replace(s) {
1753
- return String(s);
1754
- },
1753
+ replace: String,
1755
1754
  // convert to primitive string
1756
1755
  revive: function revive(s) {
1757
1756
  return new String(s);
@@ -1763,9 +1762,7 @@
1763
1762
  test: function test(x) {
1764
1763
  return toStringTag(x) === 'Boolean' && _typeof$1(x) === 'object';
1765
1764
  },
1766
- replace: function replace(b) {
1767
- return Boolean(b);
1768
- },
1765
+ replace: Boolean,
1769
1766
  // convert to primitive boolean
1770
1767
  revive: function revive(b) {
1771
1768
  // Revive to an objectified Boolean
@@ -1777,9 +1774,7 @@
1777
1774
  test: function test(x) {
1778
1775
  return toStringTag(x) === 'Number' && _typeof$1(x) === 'object';
1779
1776
  },
1780
- replace: function replace(n) {
1781
- return Number(n);
1782
- },
1777
+ replace: Number,
1783
1778
  // convert to primitive number
1784
1779
  revive: function revive(n) {
1785
1780
  return new Number(n);
@@ -1839,24 +1834,21 @@
1839
1834
  };
1840
1835
 
1841
1836
  /* eslint-env browser, node */
1842
- /* c8 ignore next */
1843
-
1844
- var _global$1 = typeof self === 'undefined' ? global : self; // Support all kinds of typed arrays (views of ArrayBuffers)
1845
-
1846
1837
 
1847
1838
  var typedArraysSocketIO = {};
1848
- ['Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array'].forEach(function (typeName) {
1849
- var arrType = typeName;
1850
- var TypedArray = _global$1[typeName];
1851
- /* c8 ignore next 3 */
1852
-
1853
- if (!TypedArray) {
1854
- return;
1855
- }
1839
+ /**
1840
+ * @param {
1841
+ * Int8Array|Uint8Array|Uint8ClampedArray|Int16Array|Uint16Array|Int32Array|
1842
+ * Uint32Array|Float32Array|Float64Array
1843
+ * } TypedArray
1844
+ * @returns {void}
1845
+ */
1856
1846
 
1847
+ function create$1(TypedArray) {
1848
+ var typeName = TypedArray.name;
1857
1849
  typedArraysSocketIO[typeName.toLowerCase()] = {
1858
1850
  test: function test(x) {
1859
- return toStringTag(x) === arrType;
1851
+ return toStringTag(x) === typeName;
1860
1852
  },
1861
1853
  replace: function replace(a) {
1862
1854
  return (a.byteOffset === 0 && a.byteLength === a.buffer.byteLength ? a // socket.io supports streaming ArrayBuffers.
@@ -1875,26 +1867,31 @@
1875
1867
  return toStringTag(buf) === 'ArrayBuffer' ? new TypedArray(buf) : buf;
1876
1868
  }
1877
1869
  };
1878
- });
1879
-
1880
- /* eslint-env browser, node */
1881
- /* c8 ignore next */
1870
+ }
1882
1871
 
1883
- var _global = typeof self === 'undefined' ? global : self;
1872
+ if (typeof Int8Array === 'function') {
1873
+ // Those constructors are added in ES6 as a group.
1874
+ // If we have Int8Array, we can assume the rest also exists.
1875
+ [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array].forEach(function (TypedArray) {
1876
+ return create$1(TypedArray);
1877
+ });
1878
+ }
1884
1879
 
1880
+ /* eslint-env browser, node */
1885
1881
  var typedArrays = {};
1886
- ['Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array'].forEach(function (typeName) {
1887
- var arrType = typeName;
1888
- var TypedArray = _global[arrType];
1889
- /* c8 ignore next 3 */
1890
-
1891
- if (!TypedArray) {
1892
- return;
1893
- }
1882
+ /**
1883
+ * @param {
1884
+ * Int8Array|Uint8Array|Uint8ClampedArray|Int16Array|Uint16Array|Int32Array|
1885
+ * Uint32Array|Float32Array|Float64Array
1886
+ * } TypedArray
1887
+ * @returns {void}
1888
+ */
1894
1889
 
1890
+ function create(TypedArray) {
1891
+ var typeName = TypedArray.name;
1895
1892
  typedArrays[typeName.toLowerCase()] = {
1896
1893
  test: function test(x) {
1897
- return toStringTag(x) === arrType;
1894
+ return toStringTag(x) === typeName;
1898
1895
  },
1899
1896
  replace: function replace(_ref, stateObj) {
1900
1897
  var buffer = _ref.buffer,
@@ -1943,7 +1940,15 @@
1943
1940
  return new TypedArray(buffer, byteOffset, len);
1944
1941
  }
1945
1942
  };
1946
- });
1943
+ }
1944
+
1945
+ if (typeof Int8Array === 'function') {
1946
+ // Those constructors are added in ES6 as a group.
1947
+ // If we have Int8Array, we can assume the rest also exists.
1948
+ [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array].forEach(function (TypedArray) {
1949
+ return create(TypedArray);
1950
+ });
1951
+ }
1947
1952
 
1948
1953
  // This does not preserve `undefined` in sparse arrays; see the `undef`
1949
1954
  var undef$1 = {