core-js-pure 3.32.2 → 3.33.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 (94) hide show
  1. package/features/regexp/escape.js +2 -0
  2. package/full/index.js +1 -0
  3. package/full/regexp/escape.js +5 -0
  4. package/full/regexp/index.js +1 -0
  5. package/internals/a-callable.js +1 -1
  6. package/internals/a-constructor.js +1 -1
  7. package/internals/a-map.js +3 -1
  8. package/internals/a-possible-prototype.js +1 -1
  9. package/internals/a-set.js +3 -1
  10. package/internals/a-weak-map.js +3 -1
  11. package/internals/a-weak-set.js +3 -1
  12. package/internals/an-instance.js +1 -1
  13. package/internals/an-object.js +1 -1
  14. package/internals/array-reduce.js +1 -1
  15. package/internals/array-set-length.js +1 -1
  16. package/internals/array-with.js +1 -1
  17. package/internals/composite-key.js +1 -1
  18. package/internals/date-to-iso-string.js +1 -1
  19. package/internals/date-to-primitive.js +1 -1
  20. package/internals/delete-property-or-throw.js +1 -1
  21. package/internals/detach-transferable.js +37 -0
  22. package/internals/error-stack-clear.js +1 -1
  23. package/internals/error-stack-installable.js +1 -1
  24. package/internals/get-iterator.js +1 -1
  25. package/internals/get-set-record.js +2 -2
  26. package/internals/ieee754.js +9 -20
  27. package/internals/internal-state.js +3 -3
  28. package/internals/is-constructor.js +1 -1
  29. package/internals/iterate.js +1 -1
  30. package/internals/map-upsert.js +1 -1
  31. package/internals/math-f16round.js +12 -0
  32. package/internals/math-float-round.js +23 -0
  33. package/internals/math-fround.js +5 -21
  34. package/internals/new-promise-capability.js +1 -1
  35. package/internals/not-a-nan.js +1 -1
  36. package/internals/not-a-regexp.js +1 -1
  37. package/internals/numeric-range-iterator.js +5 -5
  38. package/internals/object-define-property.js +1 -1
  39. package/internals/ordinary-to-primitive.js +1 -1
  40. package/internals/parse-json-string.js +4 -4
  41. package/internals/regexp-exec-abstract.js +1 -1
  42. package/internals/require-object-coercible.js +1 -1
  43. package/internals/shared.js +2 -2
  44. package/internals/string-cooked.js +1 -1
  45. package/internals/string-punycode-to-ascii.js +2 -2
  46. package/internals/string-repeat.js +1 -1
  47. package/internals/to-big-int.js +1 -1
  48. package/internals/to-index.js +1 -1
  49. package/internals/to-positive-integer.js +1 -1
  50. package/internals/to-primitive.js +1 -1
  51. package/internals/to-string.js +1 -1
  52. package/internals/validate-arguments-length.js +1 -1
  53. package/modules/es.aggregate-error.constructor.js +1 -1
  54. package/modules/es.error.cause.js +2 -1
  55. package/modules/es.number.constructor.js +1 -1
  56. package/modules/es.number.to-exponential.js +1 -1
  57. package/modules/es.number.to-fixed.js +1 -1
  58. package/modules/es.promise.constructor.js +2 -2
  59. package/modules/es.string.from-code-point.js +1 -1
  60. package/modules/es.string.match-all.js +1 -1
  61. package/modules/es.string.replace-all.js +1 -1
  62. package/modules/es.symbol.constructor.js +17 -8
  63. package/modules/es.symbol.key-for.js +1 -1
  64. package/modules/esnext.async-disposable-stack.constructor.js +1 -1
  65. package/modules/esnext.async-iterator.constructor.js +1 -1
  66. package/modules/esnext.async-iterator.reduce.js +1 -1
  67. package/modules/esnext.disposable-stack.constructor.js +1 -1
  68. package/modules/esnext.iterator.constructor.js +1 -1
  69. package/modules/esnext.iterator.range.js +1 -1
  70. package/modules/esnext.iterator.reduce.js +1 -1
  71. package/modules/esnext.json.parse.js +6 -6
  72. package/modules/esnext.json.raw-json.js +2 -2
  73. package/modules/esnext.map.reduce.js +1 -1
  74. package/modules/esnext.map.update.js +1 -1
  75. package/modules/esnext.math.f16round.js +2 -11
  76. package/modules/esnext.math.seeded-prng.js +1 -1
  77. package/modules/esnext.number.from-string.js +5 -5
  78. package/modules/esnext.observable.constructor.js +1 -2
  79. package/modules/esnext.observable.from.js +1 -2
  80. package/modules/esnext.observable.of.js +1 -2
  81. package/modules/esnext.regexp.escape.js +20 -0
  82. package/modules/esnext.set.reduce.js +1 -1
  83. package/modules/esnext.string.dedent.js +5 -5
  84. package/modules/esnext.suppressed-error.constructor.js +1 -1
  85. package/modules/web.dom-exception.constructor.js +2 -2
  86. package/modules/web.dom-exception.stack.js +2 -2
  87. package/modules/web.structured-clone.js +18 -17
  88. package/modules/web.url-search-params.constructor.js +1 -1
  89. package/modules/web.url.constructor.js +3 -3
  90. package/package.json +1 -1
  91. package/postinstall.js +1 -0
  92. package/proposals/regexp-escaping.js +3 -0
  93. package/stage/2.js +1 -0
  94. package/internals/observable-forced.js +0 -14
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+ module.exports = require('../../full/regexp/escape');
package/full/index.js CHANGED
@@ -371,6 +371,7 @@ require('../modules/esnext.reflect.get-own-metadata-keys');
371
371
  require('../modules/esnext.reflect.has-metadata');
372
372
  require('../modules/esnext.reflect.has-own-metadata');
373
373
  require('../modules/esnext.reflect.metadata');
374
+ require('../modules/esnext.regexp.escape');
374
375
  require('../modules/esnext.set.add-all');
375
376
  require('../modules/esnext.set.delete-all');
376
377
  require('../modules/esnext.set.difference.v2');
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+ require('../../modules/esnext.regexp.escape');
3
+ var path = require('../../internals/path');
4
+
5
+ module.exports = path.RegExp.escape;
@@ -1,4 +1,5 @@
1
1
  'use strict';
2
2
  var parent = require('../../actual/regexp');
3
+ require('../../modules/esnext.regexp.escape');
3
4
 
4
5
  module.exports = parent;
@@ -7,5 +7,5 @@ var $TypeError = TypeError;
7
7
  // `Assert: IsCallable(argument) is true`
8
8
  module.exports = function (argument) {
9
9
  if (isCallable(argument)) return argument;
10
- throw $TypeError(tryToString(argument) + ' is not a function');
10
+ throw new $TypeError(tryToString(argument) + ' is not a function');
11
11
  };
@@ -7,5 +7,5 @@ var $TypeError = TypeError;
7
7
  // `Assert: IsConstructor(argument) is true`
8
8
  module.exports = function (argument) {
9
9
  if (isConstructor(argument)) return argument;
10
- throw $TypeError(tryToString(argument) + ' is not a constructor');
10
+ throw new $TypeError(tryToString(argument) + ' is not a constructor');
11
11
  };
@@ -1,8 +1,10 @@
1
1
  'use strict';
2
2
  var tryToString = require('../internals/try-to-string');
3
3
 
4
+ var $TypeError = TypeError;
5
+
4
6
  // Perform ? RequireInternalSlot(M, [[MapData]])
5
7
  module.exports = function (it) {
6
8
  if (typeof it == 'object' && 'size' in it && 'has' in it && 'get' in it && 'set' in it && 'delete' in it && 'entries' in it) return it;
7
- throw TypeError(tryToString(it) + ' is not a map');
9
+ throw new $TypeError(tryToString(it) + ' is not a map');
8
10
  };
@@ -6,5 +6,5 @@ var $TypeError = TypeError;
6
6
 
7
7
  module.exports = function (argument) {
8
8
  if (typeof argument == 'object' || isCallable(argument)) return argument;
9
- throw $TypeError("Can't set " + $String(argument) + ' as a prototype');
9
+ throw new $TypeError("Can't set " + $String(argument) + ' as a prototype');
10
10
  };
@@ -1,8 +1,10 @@
1
1
  'use strict';
2
2
  var tryToString = require('../internals/try-to-string');
3
3
 
4
+ var $TypeError = TypeError;
5
+
4
6
  // Perform ? RequireInternalSlot(M, [[SetData]])
5
7
  module.exports = function (it) {
6
8
  if (typeof it == 'object' && 'size' in it && 'has' in it && 'add' in it && 'delete' in it && 'keys' in it) return it;
7
- throw TypeError(tryToString(it) + ' is not a set');
9
+ throw new $TypeError(tryToString(it) + ' is not a set');
8
10
  };
@@ -1,8 +1,10 @@
1
1
  'use strict';
2
2
  var tryToString = require('../internals/try-to-string');
3
3
 
4
+ var $TypeError = TypeError;
5
+
4
6
  // Perform ? RequireInternalSlot(M, [[WeakMapData]])
5
7
  module.exports = function (it) {
6
8
  if (typeof it == 'object' && 'has' in it && 'get' in it && 'set' in it && 'delete') return it;
7
- throw TypeError(tryToString(it) + ' is not a weakmap');
9
+ throw new $TypeError(tryToString(it) + ' is not a weakmap');
8
10
  };
@@ -1,8 +1,10 @@
1
1
  'use strict';
2
2
  var tryToString = require('../internals/try-to-string');
3
3
 
4
+ var $TypeError = TypeError;
5
+
4
6
  // Perform ? RequireInternalSlot(M, [[WeakSetData]])
5
7
  module.exports = function (it) {
6
8
  if (typeof it == 'object' && 'has' in it && 'add' in it && 'delete' in it) return it;
7
- throw TypeError(tryToString(it) + ' is not a weakset');
9
+ throw new $TypeError(tryToString(it) + ' is not a weakset');
8
10
  };
@@ -5,5 +5,5 @@ var $TypeError = TypeError;
5
5
 
6
6
  module.exports = function (it, Prototype) {
7
7
  if (isPrototypeOf(Prototype, it)) return it;
8
- throw $TypeError('Incorrect invocation');
8
+ throw new $TypeError('Incorrect invocation');
9
9
  };
@@ -7,5 +7,5 @@ var $TypeError = TypeError;
7
7
  // `Assert: Type(argument) is Object`
8
8
  module.exports = function (argument) {
9
9
  if (isObject(argument)) return argument;
10
- throw $TypeError($String(argument) + ' is not an object');
10
+ throw new $TypeError($String(argument) + ' is not an object');
11
11
  };
@@ -23,7 +23,7 @@ var createMethod = function (IS_RIGHT) {
23
23
  }
24
24
  index += i;
25
25
  if (IS_RIGHT ? index < 0 : length <= index) {
26
- throw $TypeError('Reduce of empty array with no initial value');
26
+ throw new $TypeError('Reduce of empty array with no initial value');
27
27
  }
28
28
  }
29
29
  for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
@@ -20,7 +20,7 @@ var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function () {
20
20
 
21
21
  module.exports = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) {
22
22
  if (isArray(O) && !getOwnPropertyDescriptor(O, 'length').writable) {
23
- throw $TypeError('Cannot set read only .length');
23
+ throw new $TypeError('Cannot set read only .length');
24
24
  } return O.length = length;
25
25
  } : function (O, length) {
26
26
  return O.length = length;
@@ -10,7 +10,7 @@ module.exports = function (O, C, index, value) {
10
10
  var len = lengthOfArrayLike(O);
11
11
  var relativeIndex = toIntegerOrInfinity(index);
12
12
  var actualIndex = relativeIndex < 0 ? len + relativeIndex : relativeIndex;
13
- if (actualIndex >= len || actualIndex < 0) throw $RangeError('Incorrect index');
13
+ if (actualIndex >= len || actualIndex < 0) throw new $RangeError('Incorrect index');
14
14
  var A = new C(len);
15
15
  var k = 0;
16
16
  for (; k < len; k++) A[k] = k === actualIndex ? value : O[k];
@@ -43,7 +43,7 @@ module.exports = function () {
43
43
  for (i = 0; i < length; i++) {
44
44
  if (isObject(it = arguments[i])) active = active.next(i, it, true);
45
45
  }
46
- if (this === $Object && active === root) throw $TypeError('Composite keys must contain a non-primitive component');
46
+ if (this === $Object && active === root) throw new $TypeError('Composite keys must contain a non-primitive component');
47
47
  for (i = 0; i < length; i++) {
48
48
  if (!isObject(it = arguments[i])) active = active.next(i, it, false);
49
49
  } return active;
@@ -25,7 +25,7 @@ module.exports = (fails(function () {
25
25
  }) || !fails(function () {
26
26
  nativeDateToISOString.call(new Date(NaN));
27
27
  })) ? function toISOString() {
28
- if (!$isFinite(thisTimeValue(this))) throw $RangeError('Invalid time value');
28
+ if (!$isFinite(thisTimeValue(this))) throw new $RangeError('Invalid time value');
29
29
  var date = this;
30
30
  var year = getUTCFullYear(date);
31
31
  var milliseconds = getUTCMilliseconds(date);
@@ -9,6 +9,6 @@ var $TypeError = TypeError;
9
9
  module.exports = function (hint) {
10
10
  anObject(this);
11
11
  if (hint === 'string' || hint === 'default') hint = 'string';
12
- else if (hint !== 'number') throw $TypeError('Incorrect hint');
12
+ else if (hint !== 'number') throw new $TypeError('Incorrect hint');
13
13
  return ordinaryToPrimitive(this, hint);
14
14
  };
@@ -4,5 +4,5 @@ var tryToString = require('../internals/try-to-string');
4
4
  var $TypeError = TypeError;
5
5
 
6
6
  module.exports = function (O, P) {
7
- if (!delete O[P]) throw $TypeError('Cannot delete property ' + tryToString(P) + ' of ' + tryToString(O));
7
+ if (!delete O[P]) throw new $TypeError('Cannot delete property ' + tryToString(P) + ' of ' + tryToString(O));
8
8
  };
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+ var global = require('../internals/global');
3
+ var tryNodeRequire = require('../internals/try-node-require');
4
+ var PROPER_STRUCTURED_CLONE_TRANSFER = require('../internals/structured-clone-proper-transfer');
5
+
6
+ var structuredClone = global.structuredClone;
7
+ var $ArrayBuffer = global.ArrayBuffer;
8
+ var $MessageChannel = global.MessageChannel;
9
+ var detach = false;
10
+ var WorkerThreads, channel, buffer, $detach;
11
+
12
+ if (PROPER_STRUCTURED_CLONE_TRANSFER) {
13
+ detach = function (transferable) {
14
+ structuredClone(transferable, { transfer: [transferable] });
15
+ };
16
+ } else if ($ArrayBuffer) try {
17
+ if (!$MessageChannel) {
18
+ WorkerThreads = tryNodeRequire('worker_threads');
19
+ if (WorkerThreads) $MessageChannel = WorkerThreads.MessageChannel;
20
+ }
21
+
22
+ if ($MessageChannel) {
23
+ channel = new $MessageChannel();
24
+ buffer = new $ArrayBuffer(2);
25
+
26
+ $detach = function (transferable) {
27
+ channel.port1.postMessage(null, [transferable]);
28
+ };
29
+
30
+ if (buffer.byteLength === 2) {
31
+ $detach(buffer);
32
+ if (buffer.byteLength === 0) detach = $detach;
33
+ }
34
+ }
35
+ } catch (error) { /* empty */ }
36
+
37
+ module.exports = detach;
@@ -4,7 +4,7 @@ var uncurryThis = require('../internals/function-uncurry-this');
4
4
  var $Error = Error;
5
5
  var replace = uncurryThis(''.replace);
6
6
 
7
- var TEST = (function (arg) { return String($Error(arg).stack); })('zxcasd');
7
+ var TEST = (function (arg) { return String(new $Error(arg).stack); })('zxcasd');
8
8
  // eslint-disable-next-line redos/no-vulnerable -- safe
9
9
  var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/;
10
10
  var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);
@@ -3,7 +3,7 @@ var fails = require('../internals/fails');
3
3
  var createPropertyDescriptor = require('../internals/create-property-descriptor');
4
4
 
5
5
  module.exports = !fails(function () {
6
- var error = Error('a');
6
+ var error = new Error('a');
7
7
  if (!('stack' in error)) return true;
8
8
  // eslint-disable-next-line es/no-object-defineproperty -- safe
9
9
  Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7));
@@ -10,5 +10,5 @@ var $TypeError = TypeError;
10
10
  module.exports = function (argument, usingIterator) {
11
11
  var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
12
12
  if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument));
13
- throw $TypeError(tryToString(argument) + ' is not iterable');
13
+ throw new $TypeError(tryToString(argument) + ' is not iterable');
14
14
  };
@@ -33,9 +33,9 @@ module.exports = function (obj) {
33
33
  var numSize = +obj.size;
34
34
  // NOTE: If size is undefined, then numSize will be NaN
35
35
  // eslint-disable-next-line no-self-compare -- NaN check
36
- if (numSize !== numSize) throw $TypeError(INVALID_SIZE);
36
+ if (numSize !== numSize) throw new $TypeError(INVALID_SIZE);
37
37
  var intSize = toIntegerOrInfinity(numSize);
38
- if (intSize < 0) throw $RangeError(INVALID_SIZE);
38
+ if (intSize < 0) throw new $RangeError(INVALID_SIZE);
39
39
  return new SetRecord(
40
40
  obj,
41
41
  max(intSize, 0),
@@ -1,8 +1,5 @@
1
1
  'use strict';
2
2
  // IEEE754 conversions based on https://github.com/feross/ieee754
3
- var sign = require('../internals/math-sign');
4
- var trunc = require('../internals/math-trunc');
5
-
6
3
  var $Array = Array;
7
4
  var abs = Math.abs;
8
5
  var pow = Math.pow;
@@ -10,21 +7,13 @@ var floor = Math.floor;
10
7
  var log = Math.log;
11
8
  var LN2 = Math.LN2;
12
9
 
13
- var roundToEven = function (number) {
14
- var truncated = trunc(number);
15
- var delta = abs(number - truncated);
16
- if (delta > 0.5 || delta === 0.5 && truncated % 2 !== 0) {
17
- return truncated + sign(number);
18
- } return truncated;
19
- };
20
-
21
10
  var pack = function (number, mantissaLength, bytes) {
22
11
  var buffer = $Array(bytes);
23
12
  var exponentLength = bytes * 8 - mantissaLength - 1;
24
13
  var eMax = (1 << exponentLength) - 1;
25
14
  var eBias = eMax >> 1;
26
15
  var rt = mantissaLength === 23 ? pow(2, -24) - pow(2, -77) : 0;
27
- var s = number < 0 || number === 0 && 1 / number < 0 ? 1 : 0;
16
+ var sign = number < 0 || number === 0 && 1 / number < 0 ? 1 : 0;
28
17
  var index = 0;
29
18
  var exponent, mantissa, c;
30
19
  number = abs(number);
@@ -53,10 +42,10 @@ var pack = function (number, mantissaLength, bytes) {
53
42
  mantissa = 0;
54
43
  exponent = eMax;
55
44
  } else if (exponent + eBias >= 1) {
56
- mantissa = roundToEven((number * c - 1) * pow(2, mantissaLength));
45
+ mantissa = (number * c - 1) * pow(2, mantissaLength);
57
46
  exponent += eBias;
58
47
  } else {
59
- mantissa = roundToEven(number * pow(2, eBias - 1) * pow(2, mantissaLength));
48
+ mantissa = number * pow(2, eBias - 1) * pow(2, mantissaLength);
60
49
  exponent = 0;
61
50
  }
62
51
  }
@@ -72,7 +61,7 @@ var pack = function (number, mantissaLength, bytes) {
72
61
  exponent /= 256;
73
62
  exponentLength -= 8;
74
63
  }
75
- buffer[--index] |= s * 128;
64
+ buffer[--index] |= sign * 128;
76
65
  return buffer;
77
66
  };
78
67
 
@@ -83,10 +72,10 @@ var unpack = function (buffer, mantissaLength) {
83
72
  var eBias = eMax >> 1;
84
73
  var nBits = exponentLength - 7;
85
74
  var index = bytes - 1;
86
- var s = buffer[index--];
87
- var exponent = s & 127;
75
+ var sign = buffer[index--];
76
+ var exponent = sign & 127;
88
77
  var mantissa;
89
- s >>= 7;
78
+ sign >>= 7;
90
79
  while (nBits > 0) {
91
80
  exponent = exponent * 256 + buffer[index--];
92
81
  nBits -= 8;
@@ -101,11 +90,11 @@ var unpack = function (buffer, mantissaLength) {
101
90
  if (exponent === 0) {
102
91
  exponent = 1 - eBias;
103
92
  } else if (exponent === eMax) {
104
- return mantissa ? NaN : s ? -Infinity : Infinity;
93
+ return mantissa ? NaN : sign ? -Infinity : Infinity;
105
94
  } else {
106
95
  mantissa += pow(2, mantissaLength);
107
96
  exponent -= eBias;
108
- } return (s ? -1 : 1) * mantissa * pow(2, exponent - mantissaLength);
97
+ } return (sign ? -1 : 1) * mantissa * pow(2, exponent - mantissaLength);
109
98
  };
110
99
 
111
100
  module.exports = {
@@ -21,7 +21,7 @@ var getterFor = function (TYPE) {
21
21
  return function (it) {
22
22
  var state;
23
23
  if (!isObject(it) || (state = get(it)).type !== TYPE) {
24
- throw TypeError('Incompatible receiver, ' + TYPE + ' required');
24
+ throw new TypeError('Incompatible receiver, ' + TYPE + ' required');
25
25
  } return state;
26
26
  };
27
27
  };
@@ -34,7 +34,7 @@ if (NATIVE_WEAK_MAP || shared.state) {
34
34
  store.set = store.set;
35
35
  /* eslint-enable no-self-assign -- prototype methods protection */
36
36
  set = function (it, metadata) {
37
- if (store.has(it)) throw TypeError(OBJECT_ALREADY_INITIALIZED);
37
+ if (store.has(it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
38
38
  metadata.facade = it;
39
39
  store.set(it, metadata);
40
40
  return metadata;
@@ -49,7 +49,7 @@ if (NATIVE_WEAK_MAP || shared.state) {
49
49
  var STATE = sharedKey('state');
50
50
  hiddenKeys[STATE] = true;
51
51
  set = function (it, metadata) {
52
- if (hasOwn(it, STATE)) throw TypeError(OBJECT_ALREADY_INITIALIZED);
52
+ if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
53
53
  metadata.facade = it;
54
54
  createNonEnumerableProperty(it, STATE, metadata);
55
55
  return metadata;
@@ -11,7 +11,7 @@ var empty = [];
11
11
  var construct = getBuiltIn('Reflect', 'construct');
12
12
  var constructorRegExp = /^\s*(?:class|function)\b/;
13
13
  var exec = uncurryThis(constructorRegExp.exec);
14
- var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
14
+ var INCORRECT_TO_STRING = !constructorRegExp.test(noop);
15
15
 
16
16
  var isConstructorModern = function isConstructor(argument) {
17
17
  if (!isCallable(argument)) return false;
@@ -46,7 +46,7 @@ module.exports = function (iterable, unboundFunction, options) {
46
46
  iterator = iterable;
47
47
  } else {
48
48
  iterFn = getIteratorMethod(iterable);
49
- if (!iterFn) throw $TypeError(tryToString(iterable) + ' is not iterable');
49
+ if (!iterFn) throw new $TypeError(tryToString(iterable) + ' is not iterable');
50
50
  // optimisation for array iterators
51
51
  if (isArrayIteratorMethod(iterFn)) {
52
52
  for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
@@ -16,7 +16,7 @@ module.exports = function upsert(key, updateFn /* , insertFn */) {
16
16
  var insertFn = arguments.length > 2 ? arguments[2] : undefined;
17
17
  var value;
18
18
  if (!isCallable(updateFn) && !isCallable(insertFn)) {
19
- throw $TypeError('At least one callback required');
19
+ throw new $TypeError('At least one callback required');
20
20
  }
21
21
  if (call(has, map, key)) {
22
22
  value = call(get, map, key);
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+ var floatRound = require('../internals/math-float-round');
3
+
4
+ var FLOAT16_EPSILON = 0.0009765625;
5
+ var FLOAT16_MAX_VALUE = 65504;
6
+ var FLOAT16_MIN_VALUE = 6.103515625e-05;
7
+
8
+ // `Math.f16round` method implementation
9
+ // https://github.com/tc39/proposal-float16array
10
+ module.exports = Math.f16round || function f16round(x) {
11
+ return floatRound(x, FLOAT16_EPSILON, FLOAT16_MAX_VALUE, FLOAT16_MIN_VALUE);
12
+ };
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+ var sign = require('../internals/math-sign');
3
+
4
+ var abs = Math.abs;
5
+
6
+ var EPSILON = 2.220446049250313e-16; // Number.EPSILON
7
+ var INVERSE_EPSILON = 1 / EPSILON;
8
+
9
+ var roundTiesToEven = function (n) {
10
+ return n + INVERSE_EPSILON - INVERSE_EPSILON;
11
+ };
12
+
13
+ module.exports = function (x, FLOAT_EPSILON, FLOAT_MAX_VALUE, FLOAT_MIN_VALUE) {
14
+ var n = +x;
15
+ var absolute = abs(n);
16
+ var s = sign(n);
17
+ if (absolute < FLOAT_MIN_VALUE) return s * roundTiesToEven(absolute / FLOAT_MIN_VALUE / FLOAT_EPSILON) * FLOAT_MIN_VALUE * FLOAT_EPSILON;
18
+ var a = (1 + FLOAT_EPSILON / EPSILON) * absolute;
19
+ var result = a - (a - absolute);
20
+ // eslint-disable-next-line no-self-compare -- NaN check
21
+ if (result > FLOAT_MAX_VALUE || result !== result) return s * Infinity;
22
+ return s * result;
23
+ };
@@ -1,29 +1,13 @@
1
1
  'use strict';
2
- var sign = require('../internals/math-sign');
2
+ var floatRound = require('../internals/math-float-round');
3
3
 
4
- var abs = Math.abs;
5
- var pow = Math.pow;
6
- var EPSILON = pow(2, -52);
7
- var EPSILON32 = pow(2, -23);
8
- var MAX32 = pow(2, 127) * (2 - EPSILON32);
9
- var MIN32 = pow(2, -126);
10
-
11
- var roundTiesToEven = function (n) {
12
- return n + 1 / EPSILON - 1 / EPSILON;
13
- };
4
+ var FLOAT32_EPSILON = 1.1920928955078125e-7; // 2 ** -23;
5
+ var FLOAT32_MAX_VALUE = 3.4028234663852886e+38; // 2 ** 128 - 2 ** 104
6
+ var FLOAT32_MIN_VALUE = 1.1754943508222875e-38; // 2 ** -126;
14
7
 
15
8
  // `Math.fround` method implementation
16
9
  // https://tc39.es/ecma262/#sec-math.fround
17
10
  // eslint-disable-next-line es/no-math-fround -- safe
18
11
  module.exports = Math.fround || function fround(x) {
19
- var n = +x;
20
- var $abs = abs(n);
21
- var $sign = sign(n);
22
- var a, result;
23
- if ($abs < MIN32) return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32;
24
- a = (1 + EPSILON32 / EPSILON) * $abs;
25
- result = a - (a - $abs);
26
- // eslint-disable-next-line no-self-compare -- NaN check
27
- if (result > MAX32 || result !== result) return $sign * Infinity;
28
- return $sign * result;
12
+ return floatRound(x, FLOAT32_EPSILON, FLOAT32_MAX_VALUE, FLOAT32_MIN_VALUE);
29
13
  };
@@ -6,7 +6,7 @@ var $TypeError = TypeError;
6
6
  var PromiseCapability = function (C) {
7
7
  var resolve, reject;
8
8
  this.promise = new C(function ($$resolve, $$reject) {
9
- if (resolve !== undefined || reject !== undefined) throw $TypeError('Bad Promise constructor');
9
+ if (resolve !== undefined || reject !== undefined) throw new $TypeError('Bad Promise constructor');
10
10
  resolve = $$resolve;
11
11
  reject = $$reject;
12
12
  });
@@ -4,5 +4,5 @@ var $RangeError = RangeError;
4
4
  module.exports = function (it) {
5
5
  // eslint-disable-next-line no-self-compare -- NaN check
6
6
  if (it === it) return it;
7
- throw $RangeError('NaN is not allowed');
7
+ throw new $RangeError('NaN is not allowed');
8
8
  };
@@ -5,6 +5,6 @@ var $TypeError = TypeError;
5
5
 
6
6
  module.exports = function (it) {
7
7
  if (isRegExp(it)) {
8
- throw $TypeError("The method doesn't accept regular expressions");
8
+ throw new $TypeError("The method doesn't accept regular expressions");
9
9
  } return it;
10
10
  };
@@ -19,10 +19,10 @@ var $TypeError = TypeError;
19
19
  var $RangeIterator = createIteratorConstructor(function NumericRangeIterator(start, end, option, type, zero, one) {
20
20
  // TODO: Drop the first `typeof` check after removing legacy methods in `core-js@4`
21
21
  if (typeof start != type || (end !== Infinity && end !== -Infinity && typeof end != type)) {
22
- throw $TypeError(INCORRECT_RANGE);
22
+ throw new $TypeError(INCORRECT_RANGE);
23
23
  }
24
24
  if (start === Infinity || start === -Infinity) {
25
- throw $RangeError(INCORRECT_RANGE);
25
+ throw new $RangeError(INCORRECT_RANGE);
26
26
  }
27
27
  var ifIncrease = end > start;
28
28
  var inclusiveEnd = false;
@@ -35,16 +35,16 @@ var $RangeIterator = createIteratorConstructor(function NumericRangeIterator(sta
35
35
  } else if (typeof option == type) {
36
36
  step = option;
37
37
  } else {
38
- throw $TypeError(INCORRECT_RANGE);
38
+ throw new $TypeError(INCORRECT_RANGE);
39
39
  }
40
40
  if (isNullOrUndefined(step)) {
41
41
  step = ifIncrease ? one : -one;
42
42
  }
43
43
  if (typeof step != type) {
44
- throw $TypeError(INCORRECT_RANGE);
44
+ throw new $TypeError(INCORRECT_RANGE);
45
45
  }
46
46
  if (step === Infinity || step === -Infinity || (step === zero && start !== end)) {
47
- throw $RangeError(INCORRECT_RANGE);
47
+ throw new $RangeError(INCORRECT_RANGE);
48
48
  }
49
49
  // eslint-disable-next-line no-self-compare -- NaN check
50
50
  var hitsEnd = start !== start || end !== end || step !== step || (end > start) !== (step > zero);
@@ -38,7 +38,7 @@ exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P
38
38
  if (IE8_DOM_DEFINE) try {
39
39
  return $defineProperty(O, P, Attributes);
40
40
  } catch (error) { /* empty */ }
41
- if ('get' in Attributes || 'set' in Attributes) throw $TypeError('Accessors not supported');
41
+ if ('get' in Attributes || 'set' in Attributes) throw new $TypeError('Accessors not supported');
42
42
  if ('value' in Attributes) O[P] = Attributes.value;
43
43
  return O;
44
44
  };
@@ -12,5 +12,5 @@ module.exports = function (input, pref) {
12
12
  if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
13
13
  if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;
14
14
  if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
15
- throw $TypeError("Can't convert object to primitive value");
15
+ throw new $TypeError("Can't convert object to primitive value");
16
16
  };
@@ -37,20 +37,20 @@ module.exports = function (source, i) {
37
37
  } else if (twoChars === '\\u') {
38
38
  i += 2;
39
39
  var fourHexDigits = slice(source, i, i + 4);
40
- if (!exec(IS_4_HEX_DIGITS, fourHexDigits)) throw $SyntaxError('Bad Unicode escape at: ' + i);
40
+ if (!exec(IS_4_HEX_DIGITS, fourHexDigits)) throw new $SyntaxError('Bad Unicode escape at: ' + i);
41
41
  value += fromCharCode($parseInt(fourHexDigits, 16));
42
42
  i += 4;
43
- } else throw $SyntaxError('Unknown escape sequence: "' + twoChars + '"');
43
+ } else throw new $SyntaxError('Unknown escape sequence: "' + twoChars + '"');
44
44
  } else if (chr === '"') {
45
45
  unterminated = false;
46
46
  i++;
47
47
  break;
48
48
  } else {
49
- if (exec(IS_C0_CONTROL_CODE, chr)) throw $SyntaxError('Bad control character in string literal at: ' + i);
49
+ if (exec(IS_C0_CONTROL_CODE, chr)) throw new $SyntaxError('Bad control character in string literal at: ' + i);
50
50
  value += chr;
51
51
  i++;
52
52
  }
53
53
  }
54
- if (unterminated) throw $SyntaxError('Unterminated string at: ' + i);
54
+ if (unterminated) throw new $SyntaxError('Unterminated string at: ' + i);
55
55
  return { value: value, end: i };
56
56
  };
@@ -17,5 +17,5 @@ module.exports = function (R, S) {
17
17
  return result;
18
18
  }
19
19
  if (classof(R) === 'RegExp') return call(regexpExec, R, S);
20
- throw $TypeError('RegExp#exec called on incompatible receiver');
20
+ throw new $TypeError('RegExp#exec called on incompatible receiver');
21
21
  };
@@ -6,6 +6,6 @@ var $TypeError = TypeError;
6
6
  // `RequireObjectCoercible` abstract operation
7
7
  // https://tc39.es/ecma262/#sec-requireobjectcoercible
8
8
  module.exports = function (it) {
9
- if (isNullOrUndefined(it)) throw $TypeError("Can't call method on " + it);
9
+ if (isNullOrUndefined(it)) throw new $TypeError("Can't call method on " + it);
10
10
  return it;
11
11
  };
@@ -5,9 +5,9 @@ var store = require('../internals/shared-store');
5
5
  (module.exports = function (key, value) {
6
6
  return store[key] || (store[key] = value !== undefined ? value : {});
7
7
  })('versions', []).push({
8
- version: '3.32.2',
8
+ version: '3.33.0',
9
9
  mode: IS_PURE ? 'pure' : 'global',
10
10
  copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)',
11
- license: 'https://github.com/zloirock/core-js/blob/v3.32.2/LICENSE',
11
+ license: 'https://github.com/zloirock/core-js/blob/v3.33.0/LICENSE',
12
12
  source: 'https://github.com/zloirock/core-js'
13
13
  });
@@ -19,7 +19,7 @@ module.exports = function cooked(template /* , ...substitutions */) {
19
19
  var i = 0;
20
20
  while (true) {
21
21
  var nextVal = cookedTemplate[i++];
22
- if (nextVal === undefined) throw $TypeError('Incorrect template');
22
+ if (nextVal === undefined) throw new $TypeError('Incorrect template');
23
23
  push(elements, toString(nextVal));
24
24
  if (i === literalSegments) return join(elements, '');
25
25
  if (i < argumentsLength) push(elements, toString(arguments[i]));