core-js 3.22.6 → 3.23.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 (198) hide show
  1. package/README.md +6 -6
  2. package/actual/array/find-last-index.js +2 -2
  3. package/actual/array/find-last.js +2 -2
  4. package/actual/array/group-to-map.js +6 -0
  5. package/actual/array/group.js +4 -0
  6. package/actual/array/index.js +2 -0
  7. package/actual/array/push.js +3 -0
  8. package/actual/array/unshift.js +3 -0
  9. package/actual/array/virtual/find-last-index.js +2 -2
  10. package/actual/array/virtual/find-last.js +2 -2
  11. package/actual/array/virtual/group-to-map.js +6 -0
  12. package/actual/array/virtual/group.js +4 -0
  13. package/actual/array/virtual/index.js +2 -0
  14. package/actual/array/virtual/push.js +3 -0
  15. package/actual/array/virtual/unshift.js +3 -0
  16. package/actual/instance/group-to-map.js +9 -0
  17. package/actual/instance/group.js +9 -0
  18. package/actual/instance/push.js +3 -0
  19. package/actual/instance/unshift.js +3 -0
  20. package/actual/typed-array/at.js +1 -1
  21. package/actual/typed-array/find-last-index.js +3 -0
  22. package/actual/typed-array/find-last.js +3 -0
  23. package/es/array/find-last-index.js +4 -0
  24. package/es/array/find-last.js +4 -0
  25. package/es/array/index.js +4 -0
  26. package/es/array/push.js +4 -0
  27. package/es/array/unshift.js +4 -0
  28. package/es/array/virtual/find-last-index.js +4 -0
  29. package/es/array/virtual/find-last.js +4 -0
  30. package/es/array/virtual/index.js +4 -0
  31. package/es/array/virtual/push.js +4 -0
  32. package/es/array/virtual/unshift.js +4 -0
  33. package/es/index.js +6 -0
  34. package/es/instance/find-last-index.js +9 -0
  35. package/es/instance/find-last.js +9 -0
  36. package/es/instance/push.js +9 -0
  37. package/es/instance/unshift.js +9 -0
  38. package/es/typed-array/find-last-index.js +1 -0
  39. package/es/typed-array/find-last.js +1 -0
  40. package/es/typed-array/methods.js +2 -0
  41. package/features/array/group-to-map.js +1 -0
  42. package/features/array/group.js +1 -0
  43. package/features/array/push.js +1 -0
  44. package/features/array/unshift.js +1 -0
  45. package/features/array/virtual/group-to-map.js +1 -0
  46. package/features/array/virtual/group.js +1 -0
  47. package/features/array/virtual/push.js +1 -0
  48. package/features/array/virtual/unshift.js +1 -0
  49. package/features/instance/group-to-map.js +1 -0
  50. package/features/instance/group.js +1 -0
  51. package/features/instance/push.js +1 -0
  52. package/features/instance/unshift.js +1 -0
  53. package/features/symbol/metadata-key.js +1 -0
  54. package/full/array/group-to-map.js +3 -0
  55. package/full/array/group.js +3 -0
  56. package/full/array/push.js +3 -0
  57. package/full/array/unshift.js +3 -0
  58. package/full/array/virtual/group-to-map.js +3 -0
  59. package/full/array/virtual/group.js +3 -0
  60. package/full/array/virtual/push.js +3 -0
  61. package/full/array/virtual/unshift.js +3 -0
  62. package/full/index.js +9 -0
  63. package/full/instance/group-to-map.js +3 -0
  64. package/full/instance/group.js +3 -0
  65. package/full/instance/push.js +3 -0
  66. package/full/instance/unshift.js +3 -0
  67. package/full/symbol/index.js +2 -2
  68. package/full/symbol/metadata-key.js +4 -0
  69. package/full/typed-array/at.js +1 -1
  70. package/internals/a-callable.js +2 -3
  71. package/internals/a-constructor.js +2 -3
  72. package/internals/a-possible-prototype.js +3 -4
  73. package/internals/an-instance.js +2 -3
  74. package/internals/an-object.js +3 -4
  75. package/internals/array-copy-within.js +2 -1
  76. package/internals/array-from.js +3 -4
  77. package/internals/array-group-to-map.js +32 -0
  78. package/internals/{array-group-by.js → array-group.js} +2 -3
  79. package/internals/array-reduce.js +2 -3
  80. package/internals/array-slice-simple.js +2 -3
  81. package/internals/array-species-constructor.js +3 -4
  82. package/internals/array-to-spliced.js +2 -4
  83. package/internals/array-with.js +2 -3
  84. package/internals/async-iterator-iteration.js +2 -7
  85. package/internals/classof.js +2 -3
  86. package/internals/composite-key.js +3 -4
  87. package/internals/date-to-iso-string.js +2 -3
  88. package/internals/date-to-primitive.js +2 -3
  89. package/internals/define-built-in.js +7 -2
  90. package/internals/delete-property-or-throw.js +8 -0
  91. package/internals/does-not-exceed-safe-integer.js +7 -0
  92. package/internals/engine-is-deno.js +2 -0
  93. package/internals/flatten-into-array.js +2 -4
  94. package/internals/function-bind.js +3 -4
  95. package/internals/get-iterator.js +2 -3
  96. package/internals/ieee754.js +2 -4
  97. package/internals/indexed-object.js +4 -5
  98. package/internals/is-iterable.js +2 -3
  99. package/internals/is-symbol.js +2 -3
  100. package/internals/iterate.js +2 -3
  101. package/internals/make-built-in.js +6 -5
  102. package/internals/map-upsert.js +2 -3
  103. package/internals/not-a-regexp.js +2 -3
  104. package/internals/numeric-range-iterator.js +7 -8
  105. package/internals/object-define-property.js +2 -3
  106. package/internals/object-get-prototype-of.js +5 -5
  107. package/internals/ordinary-to-primitive.js +2 -3
  108. package/internals/regexp-exec-abstract.js +2 -3
  109. package/internals/require-object-coercible.js +2 -4
  110. package/internals/shared.js +2 -2
  111. package/internals/string-punycode-to-ascii.js +3 -4
  112. package/internals/string-repeat.js +2 -3
  113. package/internals/to-big-int.js +12 -0
  114. package/internals/to-index.js +2 -3
  115. package/internals/to-object.js +2 -3
  116. package/internals/to-offset.js +2 -3
  117. package/internals/to-positive-integer.js +2 -3
  118. package/internals/to-primitive.js +2 -3
  119. package/internals/to-string.js +2 -3
  120. package/internals/try-to-string.js +2 -4
  121. package/internals/validate-arguments-length.js +2 -4
  122. package/modules/es.aggregate-error.constructor.js +5 -6
  123. package/modules/es.array.concat.js +3 -6
  124. package/modules/es.array.find-last-index.js +14 -0
  125. package/modules/es.array.find-last.js +14 -0
  126. package/modules/es.array.of.js +4 -4
  127. package/modules/es.array.push.js +39 -0
  128. package/modules/es.array.slice.js +4 -5
  129. package/modules/es.array.sort.js +2 -1
  130. package/modules/es.array.splice.js +7 -11
  131. package/modules/es.array.unshift.js +42 -0
  132. package/modules/es.date.now.js +3 -4
  133. package/modules/es.number.epsilon.js +1 -1
  134. package/modules/es.number.max-safe-integer.js +1 -1
  135. package/modules/es.number.min-safe-integer.js +1 -1
  136. package/modules/es.number.to-exponential.js +7 -8
  137. package/modules/es.number.to-fixed.js +5 -6
  138. package/modules/es.regexp.dot-all.js +2 -3
  139. package/modules/es.regexp.flags.js +38 -1
  140. package/modules/es.regexp.sticky.js +2 -3
  141. package/modules/es.regexp.test.js +2 -3
  142. package/modules/es.string.from-code-point.js +2 -3
  143. package/modules/es.string.match-all.js +2 -3
  144. package/modules/es.string.replace-all.js +2 -3
  145. package/modules/es.typed-array.fill.js +18 -9
  146. package/modules/es.typed-array.find-last-index.js +12 -0
  147. package/modules/es.typed-array.find-last.js +12 -0
  148. package/modules/esnext.array.find-last-index.js +2 -14
  149. package/modules/esnext.array.find-last.js +2 -14
  150. package/modules/esnext.array.group-by-to-map.js +4 -30
  151. package/modules/esnext.array.group-by.js +3 -2
  152. package/modules/esnext.array.group-to-map.js +11 -0
  153. package/modules/esnext.array.group.js +15 -0
  154. package/modules/esnext.array.to-reversed.js +2 -3
  155. package/modules/esnext.array.to-sorted.js +2 -3
  156. package/modules/esnext.array.to-spliced.js +2 -3
  157. package/modules/esnext.array.with.js +2 -3
  158. package/modules/esnext.async-iterator.reduce.js +2 -3
  159. package/modules/esnext.composite-key.js +2 -3
  160. package/modules/esnext.iterator.flat-map.js +2 -3
  161. package/modules/esnext.iterator.reduce.js +2 -3
  162. package/modules/esnext.map.reduce.js +2 -3
  163. package/modules/esnext.map.update.js +2 -3
  164. package/modules/esnext.math.deg-per-rad.js +1 -1
  165. package/modules/esnext.math.rad-per-deg.js +1 -1
  166. package/modules/esnext.math.seeded-prng.js +2 -3
  167. package/modules/esnext.number.from-string.js +8 -9
  168. package/modules/esnext.set.reduce.js +2 -3
  169. package/modules/esnext.string.cooked.js +2 -3
  170. package/modules/esnext.symbol.metadata-key.js +5 -0
  171. package/modules/esnext.symbol.metadata.js +1 -0
  172. package/modules/esnext.typed-array.find-last-index.js +2 -12
  173. package/modules/esnext.typed-array.find-last.js +2 -12
  174. package/modules/esnext.typed-array.group-by.js +2 -2
  175. package/modules/esnext.typed-array.with.js +21 -2
  176. package/modules/web.structured-clone.js +17 -5
  177. package/package.json +1 -1
  178. package/proposals/array-grouping-stage-3-2.js +3 -0
  179. package/proposals/array-grouping-stage-3.js +1 -0
  180. package/proposals/decorator-metadata.js +2 -0
  181. package/proposals/decorators.js +1 -2
  182. package/stable/array/find-last-index.js +1 -0
  183. package/stable/array/find-last.js +1 -0
  184. package/stable/array/push.js +3 -0
  185. package/stable/array/unshift.js +3 -0
  186. package/stable/array/virtual/find-last-index.js +1 -0
  187. package/stable/array/virtual/find-last.js +1 -0
  188. package/stable/array/virtual/push.js +3 -0
  189. package/stable/array/virtual/unshift.js +3 -0
  190. package/stable/index.js +6 -0
  191. package/stable/instance/find-last-index.js +3 -0
  192. package/stable/instance/find-last.js +3 -0
  193. package/stable/instance/push.js +3 -0
  194. package/stable/instance/unshift.js +3 -0
  195. package/stable/typed-array/find-last-index.js +1 -0
  196. package/stable/typed-array/find-last.js +1 -0
  197. package/stage/2.js +2 -1
  198. package/stage/3.js +3 -1
@@ -1,21 +1,19 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
- var global = require('../internals/global');
3
+ var toObject = require('../internals/to-object');
4
4
  var toAbsoluteIndex = require('../internals/to-absolute-index');
5
5
  var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
6
6
  var lengthOfArrayLike = require('../internals/length-of-array-like');
7
- var toObject = require('../internals/to-object');
7
+ var doesNotExceedSafeInteger = require('../internals/does-not-exceed-safe-integer');
8
8
  var arraySpeciesCreate = require('../internals/array-species-create');
9
9
  var createProperty = require('../internals/create-property');
10
+ var deletePropertyOrThrow = require('../internals/delete-property-or-throw');
10
11
  var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
11
12
 
12
13
  var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice');
13
14
 
14
- var TypeError = global.TypeError;
15
15
  var max = Math.max;
16
16
  var min = Math.min;
17
- var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
18
- var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';
19
17
 
20
18
  // `Array.prototype.splice` method
21
19
  // https://tc39.es/ecma262/#sec-array.prototype.splice
@@ -36,9 +34,7 @@ $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
36
34
  insertCount = argumentsLength - 2;
37
35
  actualDeleteCount = min(max(toIntegerOrInfinity(deleteCount), 0), len - actualStart);
38
36
  }
39
- if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) {
40
- throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
41
- }
37
+ doesNotExceedSafeInteger(len + insertCount - actualDeleteCount);
42
38
  A = arraySpeciesCreate(O, actualDeleteCount);
43
39
  for (k = 0; k < actualDeleteCount; k++) {
44
40
  from = actualStart + k;
@@ -50,15 +46,15 @@ $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
50
46
  from = k + actualDeleteCount;
51
47
  to = k + insertCount;
52
48
  if (from in O) O[to] = O[from];
53
- else delete O[to];
49
+ else deletePropertyOrThrow(O, to);
54
50
  }
55
- for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
51
+ for (k = len; k > len - actualDeleteCount + insertCount; k--) deletePropertyOrThrow(O, k - 1);
56
52
  } else if (insertCount > actualDeleteCount) {
57
53
  for (k = len - actualDeleteCount; k > actualStart; k--) {
58
54
  from = k + actualDeleteCount - 1;
59
55
  to = k + insertCount - 1;
60
56
  if (from in O) O[to] = O[from];
61
- else delete O[to];
57
+ else deletePropertyOrThrow(O, to);
62
58
  }
63
59
  }
64
60
  for (k = 0; k < insertCount; k++) {
@@ -0,0 +1,42 @@
1
+ 'use strict';
2
+ var $ = require('../internals/export');
3
+ var toObject = require('../internals/to-object');
4
+ var lengthOfArrayLike = require('../internals/length-of-array-like');
5
+ var deletePropertyOrThrow = require('../internals/delete-property-or-throw');
6
+ var doesNotExceedSafeInteger = require('../internals/does-not-exceed-safe-integer');
7
+
8
+ // IE8-
9
+ var INCORRECT_RESULT = [].unshift(0) !== 1;
10
+
11
+ // V8 ~ Chrome < 71 and Safari <= 15.4, FF < 23 throws InternalError
12
+ var SILENT_ON_NON_WRITABLE_LENGTH = !function () {
13
+ try {
14
+ // eslint-disable-next-line es-x/no-object-defineproperty -- safe
15
+ Object.defineProperty([], 'length', { writable: false }).unshift();
16
+ } catch (error) {
17
+ return error instanceof TypeError;
18
+ }
19
+ }();
20
+
21
+ // `Array.prototype.unshift` method
22
+ // https://tc39.es/ecma262/#sec-array.prototype.unshift
23
+ $({ target: 'Array', proto: true, arity: 1, forced: INCORRECT_RESULT || SILENT_ON_NON_WRITABLE_LENGTH }, {
24
+ // eslint-disable-next-line no-unused-vars -- required for `.length`
25
+ unshift: function unshift(item) {
26
+ var O = toObject(this);
27
+ var len = lengthOfArrayLike(O);
28
+ var argCount = arguments.length;
29
+ if (argCount) {
30
+ doesNotExceedSafeInteger(len + argCount);
31
+ var k = len;
32
+ while (k--) {
33
+ var to = k + argCount;
34
+ if (k in O) O[to] = O[k];
35
+ else deletePropertyOrThrow(O, to);
36
+ }
37
+ for (var j = 0; j < argCount; j++) {
38
+ O[j] = arguments[j];
39
+ }
40
+ } return O.length = len + argCount;
41
+ }
42
+ });
@@ -1,15 +1,14 @@
1
1
  // TODO: Remove from `core-js@4`
2
2
  var $ = require('../internals/export');
3
- var global = require('../internals/global');
4
3
  var uncurryThis = require('../internals/function-uncurry-this');
5
4
 
6
- var Date = global.Date;
7
- var getTime = uncurryThis(Date.prototype.getTime);
5
+ var $Date = Date;
6
+ var getTime = uncurryThis($Date.prototype.getTime);
8
7
 
9
8
  // `Date.now` method
10
9
  // https://tc39.es/ecma262/#sec-date.now
11
10
  $({ target: 'Date', stat: true }, {
12
11
  now: function now() {
13
- return getTime(new Date());
12
+ return getTime(new $Date());
14
13
  }
15
14
  });
@@ -2,6 +2,6 @@ var $ = require('../internals/export');
2
2
 
3
3
  // `Number.EPSILON` constant
4
4
  // https://tc39.es/ecma262/#sec-number.epsilon
5
- $({ target: 'Number', stat: true }, {
5
+ $({ target: 'Number', stat: true, nonConfigurable: true, nonWritable: true }, {
6
6
  EPSILON: Math.pow(2, -52)
7
7
  });
@@ -2,6 +2,6 @@ var $ = require('../internals/export');
2
2
 
3
3
  // `Number.MAX_SAFE_INTEGER` constant
4
4
  // https://tc39.es/ecma262/#sec-number.max_safe_integer
5
- $({ target: 'Number', stat: true }, {
5
+ $({ target: 'Number', stat: true, nonConfigurable: true, nonWritable: true }, {
6
6
  MAX_SAFE_INTEGER: 0x1FFFFFFFFFFFFF
7
7
  });
@@ -2,6 +2,6 @@ var $ = require('../internals/export');
2
2
 
3
3
  // `Number.MIN_SAFE_INTEGER` constant
4
4
  // https://tc39.es/ecma262/#sec-number.min_safe_integer
5
- $({ target: 'Number', stat: true }, {
5
+ $({ target: 'Number', stat: true, nonConfigurable: true, nonWritable: true }, {
6
6
  MIN_SAFE_INTEGER: -0x1FFFFFFFFFFFFF
7
7
  });
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
- var global = require('../internals/global');
4
3
  var uncurryThis = require('../internals/function-uncurry-this');
5
4
  var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
6
5
  var thisNumberValue = require('../internals/this-number-value');
@@ -8,9 +7,9 @@ var $repeat = require('../internals/string-repeat');
8
7
  var log10 = require('../internals/math-log10');
9
8
  var fails = require('../internals/fails');
10
9
 
11
- var RangeError = global.RangeError;
12
- var String = global.String;
13
- var isFinite = global.isFinite;
10
+ var $RangeError = RangeError;
11
+ var $String = String;
12
+ var $isFinite = isFinite;
14
13
  var abs = Math.abs;
15
14
  var floor = Math.floor;
16
15
  var pow = Math.pow;
@@ -51,9 +50,9 @@ $({ target: 'Number', proto: true, forced: FORCED }, {
51
50
  var x = thisNumberValue(this);
52
51
  if (fractionDigits === undefined) return un$ToExponential(x);
53
52
  var f = toIntegerOrInfinity(fractionDigits);
54
- if (!isFinite(x)) return String(x);
53
+ if (!$isFinite(x)) return String(x);
55
54
  // TODO: ES2018 increased the maximum number of fraction digits to 100, need to improve the implementation
56
- if (f < 0 || f > 20) throw RangeError('Incorrect fraction digits');
55
+ if (f < 0 || f > 20) throw $RangeError('Incorrect fraction digits');
57
56
  if (ROUNDS_PROPERLY) return un$ToExponential(x, f);
58
57
  var s = '';
59
58
  var m = '';
@@ -82,7 +81,7 @@ $({ target: 'Number', proto: true, forced: FORCED }, {
82
81
  n /= 10;
83
82
  e += 1;
84
83
  }
85
- m = String(n);
84
+ m = $String(n);
86
85
  }
87
86
  if (f !== 0) {
88
87
  m = stringSlice(m, 0, 1) + '.' + stringSlice(m, 1);
@@ -92,7 +91,7 @@ $({ target: 'Number', proto: true, forced: FORCED }, {
92
91
  d = '0';
93
92
  } else {
94
93
  c = e > 0 ? '+' : '-';
95
- d = String(abs(e));
94
+ d = $String(abs(e));
96
95
  }
97
96
  m += 'e' + c + d;
98
97
  return s + m;
@@ -1,14 +1,13 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
- var global = require('../internals/global');
4
3
  var uncurryThis = require('../internals/function-uncurry-this');
5
4
  var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
6
5
  var thisNumberValue = require('../internals/this-number-value');
7
6
  var $repeat = require('../internals/string-repeat');
8
7
  var fails = require('../internals/fails');
9
8
 
10
- var RangeError = global.RangeError;
11
- var String = global.String;
9
+ var $RangeError = RangeError;
10
+ var $String = String;
12
11
  var floor = Math.floor;
13
12
  var repeat = uncurryThis($repeat);
14
13
  var stringSlice = uncurryThis(''.slice);
@@ -56,7 +55,7 @@ var dataToString = function (data) {
56
55
  var s = '';
57
56
  while (--index >= 0) {
58
57
  if (s !== '' || index === 0 || data[index] !== 0) {
59
- var t = String(data[index]);
58
+ var t = $String(data[index]);
60
59
  s = s === '' ? t : s + repeat('0', 7 - t.length) + t;
61
60
  }
62
61
  } return s;
@@ -84,10 +83,10 @@ $({ target: 'Number', proto: true, forced: FORCED }, {
84
83
  var e, z, j, k;
85
84
 
86
85
  // TODO: ES2018 increased the maximum number of fraction digits to 100, need to improve the implementation
87
- if (fractDigits < 0 || fractDigits > 20) throw RangeError('Incorrect fraction digits');
86
+ if (fractDigits < 0 || fractDigits > 20) throw $RangeError('Incorrect fraction digits');
88
87
  // eslint-disable-next-line no-self-compare -- NaN check
89
88
  if (number != number) return 'NaN';
90
- if (number <= -1e21 || number >= 1e21) return String(number);
89
+ if (number <= -1e21 || number >= 1e21) return $String(number);
91
90
  if (number < 0) {
92
91
  sign = '-';
93
92
  number = -number;
@@ -1,4 +1,3 @@
1
- var global = require('../internals/global');
2
1
  var DESCRIPTORS = require('../internals/descriptors');
3
2
  var UNSUPPORTED_DOT_ALL = require('../internals/regexp-unsupported-dot-all');
4
3
  var classof = require('../internals/classof-raw');
@@ -6,7 +5,7 @@ var defineBuiltInAccessor = require('../internals/define-built-in-accessor');
6
5
  var getInternalState = require('../internals/internal-state').get;
7
6
 
8
7
  var RegExpPrototype = RegExp.prototype;
9
- var TypeError = global.TypeError;
8
+ var $TypeError = TypeError;
10
9
 
11
10
  // `RegExp.prototype.dotAll` getter
12
11
  // https://tc39.es/ecma262/#sec-get-regexp.prototype.dotall
@@ -20,7 +19,7 @@ if (DESCRIPTORS && UNSUPPORTED_DOT_ALL) {
20
19
  if (classof(this) === 'RegExp') {
21
20
  return !!getInternalState(this).dotAll;
22
21
  }
23
- throw TypeError('Incompatible receiver, RegExp required');
22
+ throw $TypeError('Incompatible receiver, RegExp required');
24
23
  }
25
24
  });
26
25
  }
@@ -1,13 +1,50 @@
1
+ var global = require('../internals/global');
1
2
  var DESCRIPTORS = require('../internals/descriptors');
2
3
  var defineBuiltInAccessor = require('../internals/define-built-in-accessor');
3
4
  var regExpFlags = require('../internals/regexp-flags');
4
5
  var fails = require('../internals/fails');
5
6
 
7
+ // babel-minify and Closure Compiler transpiles RegExp('.', 'd') -> /./d and it causes SyntaxError
8
+ var RegExp = global.RegExp;
6
9
  var RegExpPrototype = RegExp.prototype;
7
10
 
8
11
  var FORCED = DESCRIPTORS && fails(function () {
12
+ var INDICES_SUPPORT = true;
13
+ try {
14
+ RegExp('.', 'd');
15
+ } catch (error) {
16
+ INDICES_SUPPORT = false;
17
+ }
18
+
19
+ var O = {};
20
+ // modern V8 bug
21
+ var calls = '';
22
+ var expected = INDICES_SUPPORT ? 'dgimsy' : 'gimsy';
23
+
24
+ var addGetter = function (key, chr) {
25
+ // eslint-disable-next-line es-x/no-object-defineproperty -- safe
26
+ Object.defineProperty(O, key, { get: function () {
27
+ calls += chr;
28
+ return true;
29
+ } });
30
+ };
31
+
32
+ var pairs = {
33
+ dotAll: 's',
34
+ global: 'g',
35
+ ignoreCase: 'i',
36
+ multiline: 'm',
37
+ sticky: 'y'
38
+ };
39
+
40
+ if (INDICES_SUPPORT) pairs.hasIndices = 'd';
41
+
42
+ for (var key in pairs) addGetter(key, pairs[key]);
43
+
9
44
  // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
10
- return Object.getOwnPropertyDescriptor(RegExpPrototype, 'flags').get.call({ dotAll: true, sticky: true }) !== 'sy';
45
+ var result = Object.getOwnPropertyDescriptor(RegExpPrototype, 'flags').get.call(O);
46
+
47
+ return result !== expected || calls !== expected;
11
48
  });
12
49
 
13
50
  // `RegExp.prototype.flags` getter
@@ -1,4 +1,3 @@
1
- var global = require('../internals/global');
2
1
  var DESCRIPTORS = require('../internals/descriptors');
3
2
  var MISSED_STICKY = require('../internals/regexp-sticky-helpers').MISSED_STICKY;
4
3
  var classof = require('../internals/classof-raw');
@@ -6,7 +5,7 @@ var defineBuiltInAccessor = require('../internals/define-built-in-accessor');
6
5
  var getInternalState = require('../internals/internal-state').get;
7
6
 
8
7
  var RegExpPrototype = RegExp.prototype;
9
- var TypeError = global.TypeError;
8
+ var $TypeError = TypeError;
10
9
 
11
10
  // `RegExp.prototype.sticky` getter
12
11
  // https://tc39.es/ecma262/#sec-get-regexp.prototype.sticky
@@ -20,7 +19,7 @@ if (DESCRIPTORS && MISSED_STICKY) {
20
19
  if (classof(this) === 'RegExp') {
21
20
  return !!getInternalState(this).sticky;
22
21
  }
23
- throw TypeError('Incompatible receiver, RegExp required');
22
+ throw $TypeError('Incompatible receiver, RegExp required');
24
23
  }
25
24
  });
26
25
  }
@@ -2,7 +2,6 @@
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 $ = require('../internals/export');
5
- var global = require('../internals/global');
6
5
  var call = require('../internals/function-call');
7
6
  var uncurryThis = require('../internals/function-uncurry-this');
8
7
  var isCallable = require('../internals/is-callable');
@@ -18,7 +17,7 @@ var DELEGATES_TO_EXEC = function () {
18
17
  return re.test('abc') === true && execCalled;
19
18
  }();
20
19
 
21
- var Error = global.Error;
20
+ var $TypeError = TypeError;
22
21
  var un$Test = uncurryThis(/./.test);
23
22
 
24
23
  // `RegExp.prototype.test` method
@@ -29,7 +28,7 @@ $({ target: 'RegExp', proto: true, forced: !DELEGATES_TO_EXEC }, {
29
28
  if (!isCallable(exec)) return un$Test(this, str);
30
29
  var result = call(exec, this, str);
31
30
  if (result !== null && !isObject(result)) {
32
- throw new Error('RegExp exec method returned something other than an Object or null');
31
+ throw new $TypeError('RegExp exec method returned something other than an Object or null');
33
32
  }
34
33
  return !!result;
35
34
  }
@@ -1,9 +1,8 @@
1
1
  var $ = require('../internals/export');
2
- var global = require('../internals/global');
3
2
  var uncurryThis = require('../internals/function-uncurry-this');
4
3
  var toAbsoluteIndex = require('../internals/to-absolute-index');
5
4
 
6
- var RangeError = global.RangeError;
5
+ var $RangeError = RangeError;
7
6
  var fromCharCode = String.fromCharCode;
8
7
  // eslint-disable-next-line es-x/no-string-fromcodepoint -- required for testing
9
8
  var $fromCodePoint = String.fromCodePoint;
@@ -23,7 +22,7 @@ $({ target: 'String', stat: true, arity: 1, forced: INCORRECT_LENGTH }, {
23
22
  var code;
24
23
  while (length > i) {
25
24
  code = +arguments[i++];
26
- if (toAbsoluteIndex(code, 0x10FFFF) !== code) throw RangeError(code + ' is not a valid code point');
25
+ if (toAbsoluteIndex(code, 0x10FFFF) !== code) throw $RangeError(code + ' is not a valid code point');
27
26
  elements[i] = code < 0x10000
28
27
  ? fromCharCode(code)
29
28
  : fromCharCode(((code -= 0x10000) >> 10) + 0xD800, code % 0x400 + 0xDC00);
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
  /* eslint-disable es-x/no-string-prototype-matchall -- safe */
3
3
  var $ = require('../internals/export');
4
- var global = require('../internals/global');
5
4
  var call = require('../internals/function-call');
6
5
  var uncurryThis = require('../internals/function-uncurry-this');
7
6
  var createIteratorConstructor = require('../internals/create-iterator-constructor');
@@ -28,7 +27,7 @@ var REGEXP_STRING_ITERATOR = REGEXP_STRING + ' Iterator';
28
27
  var setInternalState = InternalStateModule.set;
29
28
  var getInternalState = InternalStateModule.getterFor(REGEXP_STRING_ITERATOR);
30
29
  var RegExpPrototype = RegExp.prototype;
31
- var TypeError = global.TypeError;
30
+ var $TypeError = TypeError;
32
31
  var stringIndexOf = uncurryThis(''.indexOf);
33
32
  var un$MatchAll = uncurryThis(''.matchAll);
34
33
 
@@ -82,7 +81,7 @@ $({ target: 'String', proto: true, forced: WORKS_WITH_NON_GLOBAL_REGEX }, {
82
81
  if (regexp != null) {
83
82
  if (isRegExp(regexp)) {
84
83
  flags = toString(requireObjectCoercible(getRegExpFlags(regexp)));
85
- if (!~stringIndexOf(flags, 'g')) throw TypeError('`.matchAll` does not allow non-global regexes');
84
+ if (!~stringIndexOf(flags, 'g')) throw $TypeError('`.matchAll` does not allow non-global regexes');
86
85
  }
87
86
  if (WORKS_WITH_NON_GLOBAL_REGEX) return un$MatchAll(O, regexp);
88
87
  matcher = getMethod(regexp, MATCH_ALL);
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
- var global = require('../internals/global');
4
3
  var call = require('../internals/function-call');
5
4
  var uncurryThis = require('../internals/function-uncurry-this');
6
5
  var requireObjectCoercible = require('../internals/require-object-coercible');
@@ -14,7 +13,7 @@ var wellKnownSymbol = require('../internals/well-known-symbol');
14
13
  var IS_PURE = require('../internals/is-pure');
15
14
 
16
15
  var REPLACE = wellKnownSymbol('replace');
17
- var TypeError = global.TypeError;
16
+ var $TypeError = TypeError;
18
17
  var indexOf = uncurryThis(''.indexOf);
19
18
  var replace = uncurryThis(''.replace);
20
19
  var stringSlice = uncurryThis(''.slice);
@@ -39,7 +38,7 @@ $({ target: 'String', proto: true }, {
39
38
  IS_REG_EXP = isRegExp(searchValue);
40
39
  if (IS_REG_EXP) {
41
40
  flags = toString(requireObjectCoercible(getRegExpFlags(searchValue)));
42
- if (!~indexOf(flags, 'g')) throw TypeError('`.replaceAll` does not allow non-global regexes');
41
+ if (!~indexOf(flags, 'g')) throw $TypeError('`.replaceAll` does not allow non-global regexes');
43
42
  }
44
43
  replacer = getMethod(searchValue, REPLACE);
45
44
  if (replacer) {
@@ -1,20 +1,29 @@
1
1
  'use strict';
2
2
  var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
3
- var call = require('../internals/function-call');
4
3
  var $fill = require('../internals/array-fill');
4
+ var toBigInt = require('../internals/to-big-int');
5
+ var classof = require('../internals/classof');
6
+ var call = require('../internals/function-call');
7
+ var uncurryThis = require('../internals/function-uncurry-this');
8
+ var fails = require('../internals/fails');
5
9
 
6
10
  var aTypedArray = ArrayBufferViewCore.aTypedArray;
7
11
  var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
12
+ var slice = uncurryThis(''.slice);
13
+
14
+ // V8 ~ Chrome < 59, Safari < 14.1, FF < 55, Edge <=18
15
+ var CONVERSION_BUG = fails(function () {
16
+ var count = 0;
17
+ // eslint-disable-next-line es-x/no-typed-arrays -- safe
18
+ new Int8Array(2).fill({ valueOf: function () { return count++; } });
19
+ return count !== 1;
20
+ });
8
21
 
9
22
  // `%TypedArray%.prototype.fill` method
10
23
  // https://tc39.es/ecma262/#sec-%typedarray%.prototype.fill
11
24
  exportTypedArrayMethod('fill', function fill(value /* , start, end */) {
12
25
  var length = arguments.length;
13
- return call(
14
- $fill,
15
- aTypedArray(this),
16
- value,
17
- length > 1 ? arguments[1] : undefined,
18
- length > 2 ? arguments[2] : undefined
19
- );
20
- });
26
+ aTypedArray(this);
27
+ var actualValue = slice(classof(this), 0, 3) === 'Big' ? toBigInt(value) : +value;
28
+ return call($fill, this, actualValue, length > 1 ? arguments[1] : undefined, length > 2 ? arguments[2] : undefined);
29
+ }, CONVERSION_BUG);
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+ var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
3
+ var $findLastIndex = require('../internals/array-iteration-from-last').findLastIndex;
4
+
5
+ var aTypedArray = ArrayBufferViewCore.aTypedArray;
6
+ var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
7
+
8
+ // `%TypedArray%.prototype.findLastIndex` method
9
+ // https://github.com/tc39/proposal-array-find-from-last
10
+ exportTypedArrayMethod('findLastIndex', function findLastIndex(predicate /* , thisArg */) {
11
+ return $findLastIndex(aTypedArray(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
12
+ });
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+ var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
3
+ var $findLast = require('../internals/array-iteration-from-last').findLast;
4
+
5
+ var aTypedArray = ArrayBufferViewCore.aTypedArray;
6
+ var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
7
+
8
+ // `%TypedArray%.prototype.findLast` method
9
+ // https://github.com/tc39/proposal-array-find-from-last
10
+ exportTypedArrayMethod('findLast', function findLast(predicate /* , thisArg */) {
11
+ return $findLast(aTypedArray(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
12
+ });
@@ -1,14 +1,2 @@
1
- 'use strict';
2
- var $ = require('../internals/export');
3
- var $findLastIndex = require('../internals/array-iteration-from-last').findLastIndex;
4
- var addToUnscopables = require('../internals/add-to-unscopables');
5
-
6
- // `Array.prototype.findLastIndex` method
7
- // https://github.com/tc39/proposal-array-find-from-last
8
- $({ target: 'Array', proto: true }, {
9
- findLastIndex: function findLastIndex(callbackfn /* , that = undefined */) {
10
- return $findLastIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
11
- }
12
- });
13
-
14
- addToUnscopables('findLastIndex');
1
+ // TODO: Remove from `core-js@4`
2
+ require('../modules/es.array.find-last-index');
@@ -1,14 +1,2 @@
1
- 'use strict';
2
- var $ = require('../internals/export');
3
- var $findLast = require('../internals/array-iteration-from-last').findLast;
4
- var addToUnscopables = require('../internals/add-to-unscopables');
5
-
6
- // `Array.prototype.findLast` method
7
- // https://github.com/tc39/proposal-array-find-from-last
8
- $({ target: 'Array', proto: true }, {
9
- findLast: function findLast(callbackfn /* , that = undefined */) {
10
- return $findLast(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
11
- }
12
- });
13
-
14
- addToUnscopables('findLast');
1
+ // TODO: Remove from `core-js@4`
2
+ require('../modules/es.array.find-last');
@@ -1,40 +1,14 @@
1
- 'use strict';
1
+ // TODO: Remove from `core-js@4`
2
2
  var $ = require('../internals/export');
3
- var getBuiltIn = require('../internals/get-built-in');
4
- var bind = require('../internals/function-bind-context');
5
- var uncurryThis = require('../internals/function-uncurry-this');
6
- var IndexedObject = require('../internals/indexed-object');
7
- var toObject = require('../internals/to-object');
8
- var lengthOfArrayLike = require('../internals/length-of-array-like');
9
3
  var arrayMethodIsStrict = require('../internals/array-method-is-strict');
10
4
  var addToUnscopables = require('../internals/add-to-unscopables');
11
-
12
- var Map = getBuiltIn('Map');
13
- var MapPrototype = Map.prototype;
14
- var mapGet = uncurryThis(MapPrototype.get);
15
- var mapHas = uncurryThis(MapPrototype.has);
16
- var mapSet = uncurryThis(MapPrototype.set);
17
- var push = uncurryThis([].push);
5
+ var $groupToMap = require('../internals/array-group-to-map');
18
6
 
19
7
  // `Array.prototype.groupByToMap` method
20
8
  // https://github.com/tc39/proposal-array-grouping
21
9
  // https://bugs.webkit.org/show_bug.cgi?id=236541
22
- $({ target: 'Array', proto: true, forced: !arrayMethodIsStrict('groupByToMap') }, {
23
- groupByToMap: function groupByToMap(callbackfn /* , thisArg */) {
24
- var O = toObject(this);
25
- var self = IndexedObject(O);
26
- var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
27
- var map = new Map();
28
- var length = lengthOfArrayLike(self);
29
- var index = 0;
30
- var key, value;
31
- for (;length > index; index++) {
32
- value = self[index];
33
- key = boundFunction(value, index, O);
34
- if (mapHas(map, key)) push(mapGet(map, key), value);
35
- else mapSet(map, key, [value]);
36
- } return map;
37
- }
10
+ $({ target: 'Array', proto: true, name: 'groupToMap', forced: !arrayMethodIsStrict('groupByToMap') }, {
11
+ groupByToMap: $groupToMap
38
12
  });
39
13
 
40
14
  addToUnscopables('groupByToMap');
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
+ // TODO: Remove from `core-js@4`
2
3
  var $ = require('../internals/export');
3
- var $groupBy = require('../internals/array-group-by');
4
+ var $group = require('../internals/array-group');
4
5
  var arrayMethodIsStrict = require('../internals/array-method-is-strict');
5
6
  var addToUnscopables = require('../internals/add-to-unscopables');
6
7
 
@@ -10,7 +11,7 @@ var addToUnscopables = require('../internals/add-to-unscopables');
10
11
  $({ target: 'Array', proto: true, forced: !arrayMethodIsStrict('groupBy') }, {
11
12
  groupBy: function groupBy(callbackfn /* , thisArg */) {
12
13
  var thisArg = arguments.length > 1 ? arguments[1] : undefined;
13
- return $groupBy(this, callbackfn, thisArg);
14
+ return $group(this, callbackfn, thisArg);
14
15
  }
15
16
  });
16
17
 
@@ -0,0 +1,11 @@
1
+ var $ = require('../internals/export');
2
+ var addToUnscopables = require('../internals/add-to-unscopables');
3
+ var $groupToMap = require('../internals/array-group-to-map');
4
+
5
+ // `Array.prototype.groupToMap` method
6
+ // https://github.com/tc39/proposal-array-grouping
7
+ $({ target: 'Array', proto: true }, {
8
+ groupToMap: $groupToMap
9
+ });
10
+
11
+ addToUnscopables('groupToMap');
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+ var $ = require('../internals/export');
3
+ var $group = require('../internals/array-group');
4
+ var addToUnscopables = require('../internals/add-to-unscopables');
5
+
6
+ // `Array.prototype.group` method
7
+ // https://github.com/tc39/proposal-array-grouping
8
+ $({ target: 'Array', proto: true }, {
9
+ group: function group(callbackfn /* , thisArg */) {
10
+ var thisArg = arguments.length > 1 ? arguments[1] : undefined;
11
+ return $group(this, callbackfn, thisArg);
12
+ }
13
+ });
14
+
15
+ addToUnscopables('group');
@@ -1,17 +1,16 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
- var global = require('../internals/global');
4
3
  var arrayToReversed = require('../internals/array-to-reversed');
5
4
  var toIndexedObject = require('../internals/to-indexed-object');
6
5
  var addToUnscopables = require('../internals/add-to-unscopables');
7
6
 
8
- var Array = global.Array;
7
+ var $Array = Array;
9
8
 
10
9
  // `Array.prototype.toReversed` method
11
10
  // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toReversed
12
11
  $({ target: 'Array', proto: true }, {
13
12
  toReversed: function toReversed() {
14
- return arrayToReversed(toIndexedObject(this), Array);
13
+ return arrayToReversed(toIndexedObject(this), $Array);
15
14
  }
16
15
  });
17
16