core-js 3.22.3 → 3.22.8

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 (157) hide show
  1. package/actual/typed-array/at.js +1 -1
  2. package/full/typed-array/at.js +1 -1
  3. package/internals/a-callable.js +2 -3
  4. package/internals/a-constructor.js +2 -3
  5. package/internals/a-possible-prototype.js +3 -4
  6. package/internals/add-to-unscopables.js +2 -2
  7. package/internals/an-instance.js +2 -3
  8. package/internals/an-object.js +3 -4
  9. package/internals/array-buffer-view-core.js +4 -4
  10. package/internals/array-buffer.js +3 -3
  11. package/internals/array-copy-within.js +2 -1
  12. package/internals/array-from.js +3 -4
  13. package/internals/array-group-by.js +2 -3
  14. package/internals/array-reduce.js +2 -3
  15. package/internals/array-slice-simple.js +2 -3
  16. package/internals/array-species-constructor.js +3 -4
  17. package/internals/array-to-spliced.js +2 -4
  18. package/internals/array-with.js +2 -3
  19. package/internals/async-from-sync-iterator.js +2 -2
  20. package/internals/async-iterator-create-proxy.js +2 -2
  21. package/internals/async-iterator-iteration.js +2 -7
  22. package/internals/async-iterator-prototype.js +2 -2
  23. package/internals/classof.js +2 -3
  24. package/internals/collection-strong.js +3 -3
  25. package/internals/collection-weak.js +3 -3
  26. package/internals/collection.js +3 -3
  27. package/internals/composite-key.js +3 -4
  28. package/internals/date-to-iso-string.js +2 -3
  29. package/internals/date-to-primitive.js +2 -3
  30. package/internals/define-built-in-accessor.js +8 -0
  31. package/internals/define-built-in.js +20 -0
  32. package/internals/define-built-ins.js +6 -0
  33. package/internals/{set-global.js → define-global-property.js} +0 -0
  34. package/internals/define-iterator.js +4 -4
  35. package/internals/delete-property-or-throw.js +8 -0
  36. package/internals/does-not-exceed-safe-integer.js +7 -0
  37. package/internals/export.js +18 -19
  38. package/internals/fix-regexp-well-known-symbol-logic.js +3 -3
  39. package/internals/flatten-into-array.js +2 -4
  40. package/internals/function-bind.js +3 -4
  41. package/internals/get-iterator.js +2 -3
  42. package/internals/ieee754.js +2 -4
  43. package/internals/indexed-object.js +4 -5
  44. package/internals/is-iterable.js +2 -3
  45. package/internals/is-symbol.js +2 -3
  46. package/internals/iterate.js +2 -3
  47. package/internals/iterator-create-proxy.js +2 -2
  48. package/internals/iterators-core.js +2 -2
  49. package/internals/make-built-in.js +48 -0
  50. package/internals/map-upsert.js +2 -3
  51. package/internals/math-expm1.js +2 -1
  52. package/internals/math-fround.js +3 -2
  53. package/internals/math-log1p.js +2 -1
  54. package/internals/math-sign.js +2 -1
  55. package/internals/math-trunc.js +10 -0
  56. package/internals/not-a-regexp.js +2 -3
  57. package/internals/numeric-range-iterator.js +7 -8
  58. package/internals/object-define-property.js +2 -3
  59. package/internals/object-get-prototype-of.js +5 -5
  60. package/internals/ordinary-to-primitive.js +2 -3
  61. package/internals/regexp-exec-abstract.js +2 -3
  62. package/internals/require-object-coercible.js +2 -4
  63. package/internals/shared-store.js +2 -2
  64. package/internals/shared.js +2 -2
  65. package/internals/string-punycode-to-ascii.js +3 -4
  66. package/internals/string-repeat.js +2 -3
  67. package/internals/symbol-define-to-primitive.js +3 -3
  68. package/internals/to-big-int.js +12 -0
  69. package/internals/to-index.js +2 -3
  70. package/internals/to-integer-or-infinity.js +3 -4
  71. package/internals/to-object.js +2 -3
  72. package/internals/to-offset.js +2 -3
  73. package/internals/to-positive-integer.js +2 -3
  74. package/internals/to-primitive.js +2 -3
  75. package/internals/to-string.js +2 -3
  76. package/internals/try-to-string.js +2 -4
  77. package/internals/typed-array-constructor.js +3 -3
  78. package/internals/validate-arguments-length.js +2 -4
  79. package/modules/es.aggregate-error.cause.js +1 -1
  80. package/modules/es.aggregate-error.constructor.js +6 -7
  81. package/modules/es.array-buffer.constructor.js +1 -1
  82. package/modules/es.array.concat.js +4 -7
  83. package/modules/es.array.of.js +4 -4
  84. package/modules/es.array.slice.js +4 -5
  85. package/modules/es.array.sort.js +2 -1
  86. package/modules/es.array.splice.js +7 -11
  87. package/modules/es.data-view.constructor.js +1 -1
  88. package/modules/es.date.now.js +3 -4
  89. package/modules/es.date.to-json.js +1 -1
  90. package/modules/es.date.to-primitive.js +2 -2
  91. package/modules/es.date.to-string.js +2 -2
  92. package/modules/es.error.cause.js +2 -2
  93. package/modules/es.error.to-string.js +2 -2
  94. package/modules/es.function.has-instance.js +3 -2
  95. package/modules/es.json.stringify.js +1 -1
  96. package/modules/es.math.acosh.js +4 -3
  97. package/modules/es.math.asinh.js +2 -1
  98. package/modules/es.math.atanh.js +2 -1
  99. package/modules/es.math.cbrt.js +2 -1
  100. package/modules/es.math.clz32.js +2 -1
  101. package/modules/es.math.hypot.js +1 -1
  102. package/modules/es.math.sinh.js +2 -1
  103. package/modules/es.math.tanh.js +4 -3
  104. package/modules/es.math.trunc.js +2 -6
  105. package/modules/es.number.constructor.js +2 -2
  106. package/modules/es.number.to-exponential.js +7 -8
  107. package/modules/es.number.to-fixed.js +5 -6
  108. package/modules/es.object.assign.js +1 -1
  109. package/modules/es.object.to-string.js +2 -2
  110. package/modules/es.promise.catch.js +2 -2
  111. package/modules/es.promise.constructor.js +17 -21
  112. package/modules/es.promise.finally.js +2 -2
  113. package/modules/es.regexp.constructor.js +2 -2
  114. package/modules/es.regexp.dot-all.js +5 -6
  115. package/modules/es.regexp.flags.js +2 -2
  116. package/modules/es.regexp.sticky.js +5 -6
  117. package/modules/es.regexp.test.js +2 -3
  118. package/modules/es.regexp.to-string.js +2 -2
  119. package/modules/es.string.from-code-point.js +3 -4
  120. package/modules/es.string.match-all.js +4 -5
  121. package/modules/es.string.replace-all.js +2 -3
  122. package/modules/es.symbol.constructor.js +5 -5
  123. package/modules/es.symbol.description.js +1 -1
  124. package/modules/es.typed-array.fill.js +18 -9
  125. package/modules/es.weak-map.constructor.js +2 -2
  126. package/modules/esnext.array.last-index.js +2 -2
  127. package/modules/esnext.array.last-item.js +2 -2
  128. package/modules/esnext.array.to-reversed.js +2 -3
  129. package/modules/esnext.array.to-sorted.js +2 -3
  130. package/modules/esnext.array.to-spliced.js +3 -4
  131. package/modules/esnext.array.with.js +2 -3
  132. package/modules/esnext.async-iterator.constructor.js +1 -1
  133. package/modules/esnext.async-iterator.reduce.js +2 -3
  134. package/modules/esnext.composite-key.js +2 -3
  135. package/modules/esnext.iterator.constructor.js +1 -1
  136. package/modules/esnext.iterator.flat-map.js +2 -3
  137. package/modules/esnext.iterator.reduce.js +2 -3
  138. package/modules/esnext.map.merge.js +1 -1
  139. package/modules/esnext.map.reduce.js +2 -3
  140. package/modules/esnext.map.update.js +2 -3
  141. package/modules/esnext.math.seeded-prng.js +2 -3
  142. package/modules/esnext.math.signbit.js +3 -1
  143. package/modules/esnext.number.from-string.js +8 -9
  144. package/modules/esnext.observable.constructor.js +12 -12
  145. package/modules/esnext.set.reduce.js +2 -3
  146. package/modules/esnext.string.cooked.js +2 -3
  147. package/modules/esnext.typed-array.to-spliced.js +1 -1
  148. package/modules/esnext.typed-array.with.js +9 -0
  149. package/modules/web.dom-exception.constructor.js +10 -10
  150. package/modules/web.dom-exception.stack.js +1 -1
  151. package/modules/web.queue-microtask.js +1 -1
  152. package/modules/web.structured-clone.js +21 -9
  153. package/modules/web.url-search-params.constructor.js +8 -8
  154. package/modules/web.url.constructor.js +43 -45
  155. package/package.json +2 -3
  156. package/internals/redefine-all.js +0 -6
  157. package/internals/redefine.js +0 -46
@@ -0,0 +1,6 @@
1
+ var defineBuiltIn = require('../internals/define-built-in');
2
+
3
+ module.exports = function (target, src, options) {
4
+ for (var key in src) defineBuiltIn(target, key, src[key], options);
5
+ return target;
6
+ };
@@ -9,7 +9,7 @@ var getPrototypeOf = require('../internals/object-get-prototype-of');
9
9
  var setPrototypeOf = require('../internals/object-set-prototype-of');
10
10
  var setToStringTag = require('../internals/set-to-string-tag');
11
11
  var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
12
- var redefine = require('../internals/redefine');
12
+ var defineBuiltIn = require('../internals/define-built-in');
13
13
  var wellKnownSymbol = require('../internals/well-known-symbol');
14
14
  var Iterators = require('../internals/iterators');
15
15
  var IteratorsCore = require('../internals/iterators-core');
@@ -56,7 +56,7 @@ module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, I
56
56
  if (setPrototypeOf) {
57
57
  setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
58
58
  } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) {
59
- redefine(CurrentIteratorPrototype, ITERATOR, returnThis);
59
+ defineBuiltIn(CurrentIteratorPrototype, ITERATOR, returnThis);
60
60
  }
61
61
  }
62
62
  // Set @@toStringTag to native iterators
@@ -84,14 +84,14 @@ module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, I
84
84
  };
85
85
  if (FORCED) for (KEY in methods) {
86
86
  if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
87
- redefine(IterablePrototype, KEY, methods[KEY]);
87
+ defineBuiltIn(IterablePrototype, KEY, methods[KEY]);
88
88
  }
89
89
  } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
90
90
  }
91
91
 
92
92
  // define iterator
93
93
  if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
94
- redefine(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT });
94
+ defineBuiltIn(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT });
95
95
  }
96
96
  Iterators[NAME] = defaultIterator;
97
97
 
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+ var tryToString = require('../internals/try-to-string');
3
+
4
+ var $TypeError = TypeError;
5
+
6
+ module.exports = function (O, P) {
7
+ if (!delete O[P]) throw $TypeError('Cannot delete property ' + tryToString(P) + ' of ' + tryToString(O));
8
+ };
@@ -0,0 +1,7 @@
1
+ var $TypeError = TypeError;
2
+ var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
3
+
4
+ module.exports = function (it) {
5
+ if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded');
6
+ return it;
7
+ };
@@ -1,25 +1,25 @@
1
1
  var global = require('../internals/global');
2
2
  var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
3
3
  var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
4
- var redefine = require('../internals/redefine');
5
- var setGlobal = require('../internals/set-global');
4
+ var defineBuiltIn = require('../internals/define-built-in');
5
+ var defineGlobalProperty = require('../internals/define-global-property');
6
6
  var copyConstructorProperties = require('../internals/copy-constructor-properties');
7
7
  var isForced = require('../internals/is-forced');
8
8
 
9
9
  /*
10
- options.target - name of the target object
11
- options.global - target is the global object
12
- options.stat - export as static methods of target
13
- options.proto - export as prototype methods of target
14
- options.real - real prototype method for the `pure` version
15
- options.forced - export even if the native feature is available
16
- options.bind - bind methods to the target, required for the `pure` version
17
- options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
18
- options.unsafe - use the simple assignment of property instead of delete + defineProperty
19
- options.sham - add a flag to not completely full polyfills
20
- options.enumerable - export as enumerable property
21
- options.noTargetGet - prevent calling a getter on target
22
- options.name - the .name of the function if it does not match the key
10
+ options.target - name of the target object
11
+ options.global - target is the global object
12
+ options.stat - export as static methods of target
13
+ options.proto - export as prototype methods of target
14
+ options.real - real prototype method for the `pure` version
15
+ options.forced - export even if the native feature is available
16
+ options.bind - bind methods to the target, required for the `pure` version
17
+ options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
18
+ options.unsafe - use the simple assignment of property instead of delete + defineProperty
19
+ options.sham - add a flag to not completely full polyfills
20
+ options.enumerable - export as enumerable property
21
+ options.dontCallGetSet - prevent calling a getter on target
22
+ options.name - the .name of the function if it does not match the key
23
23
  */
24
24
  module.exports = function (options, source) {
25
25
  var TARGET = options.target;
@@ -29,13 +29,13 @@ module.exports = function (options, source) {
29
29
  if (GLOBAL) {
30
30
  target = global;
31
31
  } else if (STATIC) {
32
- target = global[TARGET] || setGlobal(TARGET, {});
32
+ target = global[TARGET] || defineGlobalProperty(TARGET, {});
33
33
  } else {
34
34
  target = (global[TARGET] || {}).prototype;
35
35
  }
36
36
  if (target) for (key in source) {
37
37
  sourceProperty = source[key];
38
- if (options.noTargetGet) {
38
+ if (options.dontCallGetSet) {
39
39
  descriptor = getOwnPropertyDescriptor(target, key);
40
40
  targetProperty = descriptor && descriptor.value;
41
41
  } else targetProperty = target[key];
@@ -49,7 +49,6 @@ module.exports = function (options, source) {
49
49
  if (options.sham || (targetProperty && targetProperty.sham)) {
50
50
  createNonEnumerableProperty(sourceProperty, 'sham', true);
51
51
  }
52
- // extend global
53
- redefine(target, key, sourceProperty, options);
52
+ defineBuiltIn(target, key, sourceProperty, options);
54
53
  }
55
54
  };
@@ -2,7 +2,7 @@
2
2
  // TODO: Remove from `core-js@4` since it's moved to entry points
3
3
  require('../modules/es.regexp.exec');
4
4
  var uncurryThis = require('../internals/function-uncurry-this');
5
- var redefine = require('../internals/redefine');
5
+ var defineBuiltIn = require('../internals/define-built-in');
6
6
  var regexpExec = require('../internals/regexp-exec');
7
7
  var fails = require('../internals/fails');
8
8
  var wellKnownSymbol = require('../internals/well-known-symbol');
@@ -66,8 +66,8 @@ module.exports = function (KEY, exec, FORCED, SHAM) {
66
66
  return { done: false };
67
67
  });
68
68
 
69
- redefine(String.prototype, KEY, methods[0]);
70
- redefine(RegExpPrototype, SYMBOL, methods[1]);
69
+ defineBuiltIn(String.prototype, KEY, methods[0]);
70
+ defineBuiltIn(RegExpPrototype, SYMBOL, methods[1]);
71
71
  }
72
72
 
73
73
  if (SHAM) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true);
@@ -1,11 +1,9 @@
1
1
  'use strict';
2
- var global = require('../internals/global');
3
2
  var isArray = require('../internals/is-array');
4
3
  var lengthOfArrayLike = require('../internals/length-of-array-like');
4
+ var doesNotExceedSafeInteger = require('../internals/does-not-exceed-safe-integer');
5
5
  var bind = require('../internals/function-bind-context');
6
6
 
7
- var TypeError = global.TypeError;
8
-
9
7
  // `FlattenIntoArray` abstract operation
10
8
  // https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray
11
9
  var flattenIntoArray = function (target, original, source, sourceLen, start, depth, mapper, thisArg) {
@@ -22,7 +20,7 @@ var flattenIntoArray = function (target, original, source, sourceLen, start, dep
22
20
  elementLen = lengthOfArrayLike(element);
23
21
  targetIndex = flattenIntoArray(target, original, element, elementLen, targetIndex, depth - 1) - 1;
24
22
  } else {
25
- if (targetIndex >= 0x1FFFFFFFFFFFFF) throw TypeError('Exceed the acceptable array length');
23
+ doesNotExceedSafeInteger(targetIndex + 1);
26
24
  target[targetIndex] = element;
27
25
  }
28
26
 
@@ -1,5 +1,4 @@
1
1
  'use strict';
2
- var global = require('../internals/global');
3
2
  var uncurryThis = require('../internals/function-uncurry-this');
4
3
  var aCallable = require('../internals/a-callable');
5
4
  var isObject = require('../internals/is-object');
@@ -7,7 +6,7 @@ var hasOwn = require('../internals/has-own-property');
7
6
  var arraySlice = require('../internals/array-slice');
8
7
  var NATIVE_BIND = require('../internals/function-bind-native');
9
8
 
10
- var Function = global.Function;
9
+ var $Function = Function;
11
10
  var concat = uncurryThis([].concat);
12
11
  var join = uncurryThis([].join);
13
12
  var factories = {};
@@ -15,13 +14,13 @@ var factories = {};
15
14
  var construct = function (C, argsLength, args) {
16
15
  if (!hasOwn(factories, argsLength)) {
17
16
  for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']';
18
- factories[argsLength] = Function('C,a', 'return new C(' + join(list, ',') + ')');
17
+ factories[argsLength] = $Function('C,a', 'return new C(' + join(list, ',') + ')');
19
18
  } return factories[argsLength](C, args);
20
19
  };
21
20
 
22
21
  // `Function.prototype.bind` method implementation
23
22
  // https://tc39.es/ecma262/#sec-function.prototype.bind
24
- module.exports = NATIVE_BIND ? Function.bind : function bind(that /* , ...args */) {
23
+ module.exports = NATIVE_BIND ? $Function.bind : function bind(that /* , ...args */) {
25
24
  var F = aCallable(this);
26
25
  var Prototype = F.prototype;
27
26
  var partArgs = arraySlice(arguments, 1);
@@ -1,14 +1,13 @@
1
- var global = require('../internals/global');
2
1
  var call = require('../internals/function-call');
3
2
  var aCallable = require('../internals/a-callable');
4
3
  var anObject = require('../internals/an-object');
5
4
  var tryToString = require('../internals/try-to-string');
6
5
  var getIteratorMethod = require('../internals/get-iterator-method');
7
6
 
8
- var TypeError = global.TypeError;
7
+ var $TypeError = TypeError;
9
8
 
10
9
  module.exports = function (argument, usingIterator) {
11
10
  var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
12
11
  if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument));
13
- throw TypeError(tryToString(argument) + ' is not iterable');
12
+ throw $TypeError(tryToString(argument) + ' is not iterable');
14
13
  };
@@ -1,7 +1,5 @@
1
1
  // IEEE754 conversions based on https://github.com/feross/ieee754
2
- var global = require('../internals/global');
3
-
4
- var Array = global.Array;
2
+ var $Array = Array;
5
3
  var abs = Math.abs;
6
4
  var pow = Math.pow;
7
5
  var floor = Math.floor;
@@ -9,7 +7,7 @@ var log = Math.log;
9
7
  var LN2 = Math.LN2;
10
8
 
11
9
  var pack = function (number, mantissaLength, bytes) {
12
- var buffer = Array(bytes);
10
+ var buffer = $Array(bytes);
13
11
  var exponentLength = bytes * 8 - mantissaLength - 1;
14
12
  var eMax = (1 << exponentLength) - 1;
15
13
  var eBias = eMax >> 1;
@@ -1,16 +1,15 @@
1
- var global = require('../internals/global');
2
1
  var uncurryThis = require('../internals/function-uncurry-this');
3
2
  var fails = require('../internals/fails');
4
3
  var classof = require('../internals/classof-raw');
5
4
 
6
- var Object = global.Object;
5
+ var $Object = Object;
7
6
  var split = uncurryThis(''.split);
8
7
 
9
8
  // fallback for non-array-like ES3 and non-enumerable old V8 strings
10
9
  module.exports = fails(function () {
11
10
  // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
12
11
  // eslint-disable-next-line no-prototype-builtins -- safe
13
- return !Object('z').propertyIsEnumerable(0);
12
+ return !$Object('z').propertyIsEnumerable(0);
14
13
  }) ? function (it) {
15
- return classof(it) == 'String' ? split(it, '') : Object(it);
16
- } : Object;
14
+ return classof(it) == 'String' ? split(it, '') : $Object(it);
15
+ } : $Object;
@@ -1,14 +1,13 @@
1
- var global = require('../internals/global');
2
1
  var classof = require('../internals/classof');
3
2
  var hasOwn = require('../internals/has-own-property');
4
3
  var wellKnownSymbol = require('../internals/well-known-symbol');
5
4
  var Iterators = require('../internals/iterators');
6
5
 
7
6
  var ITERATOR = wellKnownSymbol('iterator');
8
- var Object = global.Object;
7
+ var $Object = Object;
9
8
 
10
9
  module.exports = function (it) {
11
- var O = Object(it);
10
+ var O = $Object(it);
12
11
  return O[ITERATOR] !== undefined
13
12
  || '@@iterator' in O
14
13
  || hasOwn(Iterators, classof(O));
@@ -1,14 +1,13 @@
1
- var global = require('../internals/global');
2
1
  var getBuiltIn = require('../internals/get-built-in');
3
2
  var isCallable = require('../internals/is-callable');
4
3
  var isPrototypeOf = require('../internals/object-is-prototype-of');
5
4
  var USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');
6
5
 
7
- var Object = global.Object;
6
+ var $Object = Object;
8
7
 
9
8
  module.exports = USE_SYMBOL_AS_UID ? function (it) {
10
9
  return typeof it == 'symbol';
11
10
  } : function (it) {
12
11
  var $Symbol = getBuiltIn('Symbol');
13
- return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, Object(it));
12
+ return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
14
13
  };
@@ -1,4 +1,3 @@
1
- var global = require('../internals/global');
2
1
  var bind = require('../internals/function-bind-context');
3
2
  var call = require('../internals/function-call');
4
3
  var anObject = require('../internals/an-object');
@@ -10,7 +9,7 @@ var getIterator = require('../internals/get-iterator');
10
9
  var getIteratorMethod = require('../internals/get-iterator-method');
11
10
  var iteratorClose = require('../internals/iterator-close');
12
11
 
13
- var TypeError = global.TypeError;
12
+ var $TypeError = TypeError;
14
13
 
15
14
  var Result = function (stopped, result) {
16
15
  this.stopped = stopped;
@@ -43,7 +42,7 @@ module.exports = function (iterable, unboundFunction, options) {
43
42
  iterator = iterable;
44
43
  } else {
45
44
  iterFn = getIteratorMethod(iterable);
46
- if (!iterFn) throw TypeError(tryToString(iterable) + ' is not iterable');
45
+ if (!iterFn) throw $TypeError(tryToString(iterable) + ' is not iterable');
47
46
  // optimisation for array iterators
48
47
  if (isArrayIteratorMethod(iterFn)) {
49
48
  for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
@@ -4,7 +4,7 @@ var aCallable = require('../internals/a-callable');
4
4
  var anObject = require('../internals/an-object');
5
5
  var create = require('../internals/object-create');
6
6
  var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
7
- var redefineAll = require('../internals/redefine-all');
7
+ var defineBuiltIns = require('../internals/define-built-ins');
8
8
  var wellKnownSymbol = require('../internals/well-known-symbol');
9
9
  var InternalStateModule = require('../internals/internal-state');
10
10
  var getMethod = require('../internals/get-method');
@@ -25,7 +25,7 @@ module.exports = function (nextHandler, IS_ITERATOR) {
25
25
  setInternalState(this, state);
26
26
  };
27
27
 
28
- IteratorProxy.prototype = redefineAll(create(IteratorPrototype), {
28
+ IteratorProxy.prototype = defineBuiltIns(create(IteratorPrototype), {
29
29
  next: function next(arg) {
30
30
  var state = getInternalState(this);
31
31
  var args = arguments.length ? [state.ignoreArg ? undefined : arg] : IS_ITERATOR ? [] : [undefined];
@@ -3,7 +3,7 @@ var fails = require('../internals/fails');
3
3
  var isCallable = require('../internals/is-callable');
4
4
  var create = require('../internals/object-create');
5
5
  var getPrototypeOf = require('../internals/object-get-prototype-of');
6
- var redefine = require('../internals/redefine');
6
+ var defineBuiltIn = require('../internals/define-built-in');
7
7
  var wellKnownSymbol = require('../internals/well-known-symbol');
8
8
  var IS_PURE = require('../internals/is-pure');
9
9
 
@@ -37,7 +37,7 @@ else if (IS_PURE) IteratorPrototype = create(IteratorPrototype);
37
37
  // `%IteratorPrototype%[@@iterator]()` method
38
38
  // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
39
39
  if (!isCallable(IteratorPrototype[ITERATOR])) {
40
- redefine(IteratorPrototype, ITERATOR, function () {
40
+ defineBuiltIn(IteratorPrototype, ITERATOR, function () {
41
41
  return this;
42
42
  });
43
43
  }
@@ -0,0 +1,48 @@
1
+ var fails = require('../internals/fails');
2
+ var isCallable = require('../internals/is-callable');
3
+ var hasOwn = require('../internals/has-own-property');
4
+ var DESCRIPTORS = require('../internals/descriptors');
5
+ var CONFIGURABLE_FUNCTION_NAME = require('../internals/function-name').CONFIGURABLE;
6
+ var inspectSource = require('../internals/inspect-source');
7
+ var InternalStateModule = require('../internals/internal-state');
8
+
9
+ var enforceInternalState = InternalStateModule.enforce;
10
+ var getInternalState = InternalStateModule.get;
11
+ // eslint-disable-next-line es-x/no-object-defineproperty -- safe
12
+ var defineProperty = Object.defineProperty;
13
+
14
+ var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function () {
15
+ return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
16
+ });
17
+
18
+ var TEMPLATE = String(String).split('String');
19
+
20
+ var makeBuiltIn = module.exports = function (value, name, options) {
21
+ if (String(name).slice(0, 7) === 'Symbol(') {
22
+ name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
23
+ }
24
+ if (options && options.getter) name = 'get ' + name;
25
+ if (options && options.setter) name = 'set ' + name;
26
+ if (!hasOwn(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
27
+ defineProperty(value, 'name', { value: name, configurable: true });
28
+ }
29
+ if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) {
30
+ defineProperty(value, 'length', { value: options.arity });
31
+ }
32
+ try {
33
+ if (options && hasOwn(options, 'constructor') && options.constructor) {
34
+ if (DESCRIPTORS) defineProperty(value, 'prototype', { writable: false });
35
+ // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
36
+ } else if (value.prototype) value.prototype = undefined;
37
+ } catch (error) { /* empty */ }
38
+ var state = enforceInternalState(value);
39
+ if (!hasOwn(state, 'source')) {
40
+ state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
41
+ } return value;
42
+ };
43
+
44
+ // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
45
+ // eslint-disable-next-line no-extend-native -- required
46
+ Function.prototype.toString = makeBuiltIn(function toString() {
47
+ return isCallable(this) && getInternalState(this).source || inspectSource(this);
48
+ }, 'toString');
@@ -1,11 +1,10 @@
1
1
  'use strict';
2
- var global = require('../internals/global');
3
2
  var call = require('../internals/function-call');
4
3
  var aCallable = require('../internals/a-callable');
5
4
  var isCallable = require('../internals/is-callable');
6
5
  var anObject = require('../internals/an-object');
7
6
 
8
- var TypeError = global.TypeError;
7
+ var $TypeError = TypeError;
9
8
 
10
9
  // `Map.prototype.upsert` method
11
10
  // https://github.com/thumbsupep/proposal-upsert
@@ -17,7 +16,7 @@ module.exports = function upsert(key, updateFn /* , insertFn */) {
17
16
  var insertFn = arguments.length > 2 ? arguments[2] : undefined;
18
17
  var value;
19
18
  if (!isCallable(updateFn) && !isCallable(insertFn)) {
20
- throw TypeError('At least one callback required');
19
+ throw $TypeError('At least one callback required');
21
20
  }
22
21
  if (call(has, map, key)) {
23
22
  value = call(get, map, key);
@@ -10,5 +10,6 @@ module.exports = (!$expm1
10
10
  // Tor Browser bug
11
11
  || $expm1(-2e-17) != -2e-17
12
12
  ) ? function expm1(x) {
13
- return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : exp(x) - 1;
13
+ var n = +x;
14
+ return n == 0 ? n : n > -1e-6 && n < 1e-6 ? n + n * n / 2 : exp(n) - 1;
14
15
  } : $expm1;
@@ -15,8 +15,9 @@ var roundTiesToEven = function (n) {
15
15
  // https://tc39.es/ecma262/#sec-math.fround
16
16
  // eslint-disable-next-line es-x/no-math-fround -- safe
17
17
  module.exports = Math.fround || function fround(x) {
18
- var $abs = abs(x);
19
- var $sign = sign(x);
18
+ var n = +x;
19
+ var $abs = abs(n);
20
+ var $sign = sign(n);
20
21
  var a, result;
21
22
  if ($abs < MIN32) return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32;
22
23
  a = (1 + EPSILON32 / EPSILON) * $abs;
@@ -4,5 +4,6 @@ var log = Math.log;
4
4
  // https://tc39.es/ecma262/#sec-math.log1p
5
5
  // eslint-disable-next-line es-x/no-math-log1p -- safe
6
6
  module.exports = Math.log1p || function log1p(x) {
7
- return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : log(1 + x);
7
+ var n = +x;
8
+ return n > -1e-8 && n < 1e-8 ? n - n * n / 2 : log(1 + n);
8
9
  };
@@ -2,6 +2,7 @@
2
2
  // https://tc39.es/ecma262/#sec-math.sign
3
3
  // eslint-disable-next-line es-x/no-math-sign -- safe
4
4
  module.exports = Math.sign || function sign(x) {
5
+ var n = +x;
5
6
  // eslint-disable-next-line no-self-compare -- NaN check
6
- return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;
7
+ return n == 0 || n != n ? n : n < 0 ? -1 : 1;
7
8
  };
@@ -0,0 +1,10 @@
1
+ var ceil = Math.ceil;
2
+ var floor = Math.floor;
3
+
4
+ // `Math.trunc` method
5
+ // https://tc39.es/ecma262/#sec-math.trunc
6
+ // eslint-disable-next-line es-x/no-math-trunc -- safe
7
+ module.exports = Math.trunc || function trunc(x) {
8
+ var n = +x;
9
+ return (n > 0 ? floor : ceil)(n);
10
+ };
@@ -1,10 +1,9 @@
1
- var global = require('../internals/global');
2
1
  var isRegExp = require('../internals/is-regexp');
3
2
 
4
- var TypeError = global.TypeError;
3
+ var $TypeError = TypeError;
5
4
 
6
5
  module.exports = function (it) {
7
6
  if (isRegExp(it)) {
8
- throw TypeError("The method doesn't accept regular expressions");
7
+ throw $TypeError("The method doesn't accept regular expressions");
9
8
  } return it;
10
9
  };
@@ -1,5 +1,4 @@
1
1
  'use strict';
2
- var global = require('../internals/global');
3
2
  var InternalStateModule = require('../internals/internal-state');
4
3
  var createIteratorConstructor = require('../internals/create-iterator-constructor');
5
4
  var isObject = require('../internals/is-object');
@@ -12,15 +11,15 @@ var NUMERIC_RANGE_ITERATOR = 'NumericRangeIterator';
12
11
  var setInternalState = InternalStateModule.set;
13
12
  var getInternalState = InternalStateModule.getterFor(NUMERIC_RANGE_ITERATOR);
14
13
 
15
- var RangeError = global.RangeError;
16
- var TypeError = global.TypeError;
14
+ var $RangeError = RangeError;
15
+ var $TypeError = TypeError;
17
16
 
18
17
  var $RangeIterator = createIteratorConstructor(function NumericRangeIterator(start, end, option, type, zero, one) {
19
18
  if (typeof start != type || (end !== Infinity && end !== -Infinity && typeof end != type)) {
20
- throw new TypeError(INCORRECT_RANGE);
19
+ throw new $TypeError(INCORRECT_RANGE);
21
20
  }
22
21
  if (start === Infinity || start === -Infinity) {
23
- throw new RangeError(INCORRECT_RANGE);
22
+ throw new $RangeError(INCORRECT_RANGE);
24
23
  }
25
24
  var ifIncrease = end > start;
26
25
  var inclusiveEnd = false;
@@ -33,16 +32,16 @@ var $RangeIterator = createIteratorConstructor(function NumericRangeIterator(sta
33
32
  } else if (typeof option == type) {
34
33
  step = option;
35
34
  } else {
36
- throw new TypeError(INCORRECT_RANGE);
35
+ throw new $TypeError(INCORRECT_RANGE);
37
36
  }
38
37
  if (step == null) {
39
38
  step = ifIncrease ? one : -one;
40
39
  }
41
40
  if (typeof step != type) {
42
- throw new TypeError(INCORRECT_RANGE);
41
+ throw new $TypeError(INCORRECT_RANGE);
43
42
  }
44
43
  if (step === Infinity || step === -Infinity || (step === zero && start !== end)) {
45
- throw new RangeError(INCORRECT_RANGE);
44
+ throw new $RangeError(INCORRECT_RANGE);
46
45
  }
47
46
  // eslint-disable-next-line no-self-compare -- NaN check
48
47
  var hitsEnd = start != start || end != end || step != step || (end > start) !== (step > zero);
@@ -1,11 +1,10 @@
1
- var global = require('../internals/global');
2
1
  var DESCRIPTORS = require('../internals/descriptors');
3
2
  var IE8_DOM_DEFINE = require('../internals/ie8-dom-define');
4
3
  var V8_PROTOTYPE_DEFINE_BUG = require('../internals/v8-prototype-define-bug');
5
4
  var anObject = require('../internals/an-object');
6
5
  var toPropertyKey = require('../internals/to-property-key');
7
6
 
8
- var TypeError = global.TypeError;
7
+ var $TypeError = TypeError;
9
8
  // eslint-disable-next-line es-x/no-object-defineproperty -- safe
10
9
  var $defineProperty = Object.defineProperty;
11
10
  // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
@@ -38,7 +37,7 @@ exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P
38
37
  if (IE8_DOM_DEFINE) try {
39
38
  return $defineProperty(O, P, Attributes);
40
39
  } catch (error) { /* empty */ }
41
- if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
40
+ if ('get' in Attributes || 'set' in Attributes) throw $TypeError('Accessors not supported');
42
41
  if ('value' in Attributes) O[P] = Attributes.value;
43
42
  return O;
44
43
  };
@@ -1,4 +1,3 @@
1
- var global = require('../internals/global');
2
1
  var hasOwn = require('../internals/has-own-property');
3
2
  var isCallable = require('../internals/is-callable');
4
3
  var toObject = require('../internals/to-object');
@@ -6,16 +5,17 @@ var sharedKey = require('../internals/shared-key');
6
5
  var CORRECT_PROTOTYPE_GETTER = require('../internals/correct-prototype-getter');
7
6
 
8
7
  var IE_PROTO = sharedKey('IE_PROTO');
9
- var Object = global.Object;
10
- var ObjectPrototype = Object.prototype;
8
+ var $Object = Object;
9
+ var ObjectPrototype = $Object.prototype;
11
10
 
12
11
  // `Object.getPrototypeOf` method
13
12
  // https://tc39.es/ecma262/#sec-object.getprototypeof
14
- module.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) {
13
+ // eslint-disable-next-line es-x/no-object-getprototypeof -- safe
14
+ module.exports = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {
15
15
  var object = toObject(O);
16
16
  if (hasOwn(object, IE_PROTO)) return object[IE_PROTO];
17
17
  var constructor = object.constructor;
18
18
  if (isCallable(constructor) && object instanceof constructor) {
19
19
  return constructor.prototype;
20
- } return object instanceof Object ? ObjectPrototype : null;
20
+ } return object instanceof $Object ? ObjectPrototype : null;
21
21
  };
@@ -1,9 +1,8 @@
1
- var global = require('../internals/global');
2
1
  var call = require('../internals/function-call');
3
2
  var isCallable = require('../internals/is-callable');
4
3
  var isObject = require('../internals/is-object');
5
4
 
6
- var TypeError = global.TypeError;
5
+ var $TypeError = TypeError;
7
6
 
8
7
  // `OrdinaryToPrimitive` abstract operation
9
8
  // https://tc39.es/ecma262/#sec-ordinarytoprimitive
@@ -12,5 +11,5 @@ module.exports = function (input, pref) {
12
11
  if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
13
12
  if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;
14
13
  if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
15
- throw TypeError("Can't convert object to primitive value");
14
+ throw $TypeError("Can't convert object to primitive value");
16
15
  };
@@ -1,11 +1,10 @@
1
- var global = require('../internals/global');
2
1
  var call = require('../internals/function-call');
3
2
  var anObject = require('../internals/an-object');
4
3
  var isCallable = require('../internals/is-callable');
5
4
  var classof = require('../internals/classof-raw');
6
5
  var regexpExec = require('../internals/regexp-exec');
7
6
 
8
- var TypeError = global.TypeError;
7
+ var $TypeError = TypeError;
9
8
 
10
9
  // `RegExpExec` abstract operation
11
10
  // https://tc39.es/ecma262/#sec-regexpexec
@@ -17,5 +16,5 @@ module.exports = function (R, S) {
17
16
  return result;
18
17
  }
19
18
  if (classof(R) === 'RegExp') return call(regexpExec, R, S);
20
- throw TypeError('RegExp#exec called on incompatible receiver');
19
+ throw $TypeError('RegExp#exec called on incompatible receiver');
21
20
  };