core-js 3.22.8 → 3.23.2

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 (126) 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/find-last-index.js +3 -0
  21. package/actual/typed-array/find-last.js +3 -0
  22. package/es/array/find-last-index.js +4 -0
  23. package/es/array/find-last.js +4 -0
  24. package/es/array/index.js +4 -0
  25. package/es/array/push.js +4 -0
  26. package/es/array/unshift.js +4 -0
  27. package/es/array/virtual/find-last-index.js +4 -0
  28. package/es/array/virtual/find-last.js +4 -0
  29. package/es/array/virtual/index.js +4 -0
  30. package/es/array/virtual/push.js +4 -0
  31. package/es/array/virtual/unshift.js +4 -0
  32. package/es/index.js +6 -0
  33. package/es/instance/find-last-index.js +9 -0
  34. package/es/instance/find-last.js +9 -0
  35. package/es/instance/push.js +9 -0
  36. package/es/instance/unshift.js +9 -0
  37. package/es/typed-array/find-last-index.js +1 -0
  38. package/es/typed-array/find-last.js +1 -0
  39. package/es/typed-array/methods.js +2 -0
  40. package/features/array/group-to-map.js +1 -0
  41. package/features/array/group.js +1 -0
  42. package/features/array/push.js +1 -0
  43. package/features/array/unshift.js +1 -0
  44. package/features/array/virtual/group-to-map.js +1 -0
  45. package/features/array/virtual/group.js +1 -0
  46. package/features/array/virtual/push.js +1 -0
  47. package/features/array/virtual/unshift.js +1 -0
  48. package/features/instance/group-to-map.js +1 -0
  49. package/features/instance/group.js +1 -0
  50. package/features/instance/push.js +1 -0
  51. package/features/instance/unshift.js +1 -0
  52. package/features/symbol/metadata-key.js +1 -0
  53. package/full/array/group-to-map.js +3 -0
  54. package/full/array/group.js +3 -0
  55. package/full/array/push.js +3 -0
  56. package/full/array/unshift.js +3 -0
  57. package/full/array/virtual/group-to-map.js +3 -0
  58. package/full/array/virtual/group.js +3 -0
  59. package/full/array/virtual/push.js +3 -0
  60. package/full/array/virtual/unshift.js +3 -0
  61. package/full/index.js +9 -0
  62. package/full/instance/group-to-map.js +3 -0
  63. package/full/instance/group.js +3 -0
  64. package/full/instance/push.js +3 -0
  65. package/full/instance/unshift.js +3 -0
  66. package/full/symbol/index.js +2 -2
  67. package/full/symbol/metadata-key.js +4 -0
  68. package/internals/array-buffer-view-core.js +14 -4
  69. package/internals/array-group-to-map.js +32 -0
  70. package/internals/{array-group-by.js → array-group.js} +0 -0
  71. package/internals/define-built-in.js +7 -2
  72. package/internals/engine-is-deno.js +2 -0
  73. package/internals/regexp-flags.js +1 -0
  74. package/internals/shared.js +2 -2
  75. package/internals/typed-array-constructor.js +2 -2
  76. package/internals/typed-array-species-constructor.js +2 -2
  77. package/modules/es.array.find-last-index.js +14 -0
  78. package/modules/es.array.find-last.js +14 -0
  79. package/modules/es.array.push.js +39 -0
  80. package/modules/es.array.unshift.js +42 -0
  81. package/modules/es.number.epsilon.js +1 -1
  82. package/modules/es.number.max-safe-integer.js +1 -1
  83. package/modules/es.number.min-safe-integer.js +1 -1
  84. package/modules/es.regexp.flags.js +38 -1
  85. package/modules/es.typed-array.find-last-index.js +12 -0
  86. package/modules/es.typed-array.find-last.js +12 -0
  87. package/modules/esnext.array.find-last-index.js +2 -14
  88. package/modules/esnext.array.find-last.js +2 -14
  89. package/modules/esnext.array.group-by-to-map.js +4 -30
  90. package/modules/esnext.array.group-by.js +3 -2
  91. package/modules/esnext.array.group-to-map.js +11 -0
  92. package/modules/esnext.array.group.js +15 -0
  93. package/modules/esnext.math.deg-per-rad.js +1 -1
  94. package/modules/esnext.math.rad-per-deg.js +1 -1
  95. package/modules/esnext.symbol.metadata-key.js +5 -0
  96. package/modules/esnext.symbol.metadata.js +1 -0
  97. package/modules/esnext.typed-array.find-last-index.js +2 -12
  98. package/modules/esnext.typed-array.find-last.js +2 -12
  99. package/modules/esnext.typed-array.group-by.js +2 -2
  100. package/modules/esnext.typed-array.to-reversed.js +2 -2
  101. package/modules/esnext.typed-array.to-sorted.js +2 -2
  102. package/modules/esnext.typed-array.to-spliced.js +2 -2
  103. package/modules/esnext.typed-array.with.js +22 -12
  104. package/modules/web.structured-clone.js +17 -5
  105. package/package.json +1 -1
  106. package/proposals/array-grouping-stage-3-2.js +3 -0
  107. package/proposals/array-grouping-stage-3.js +1 -0
  108. package/proposals/decorator-metadata.js +2 -0
  109. package/proposals/decorators.js +1 -2
  110. package/stable/array/find-last-index.js +1 -0
  111. package/stable/array/find-last.js +1 -0
  112. package/stable/array/push.js +3 -0
  113. package/stable/array/unshift.js +3 -0
  114. package/stable/array/virtual/find-last-index.js +1 -0
  115. package/stable/array/virtual/find-last.js +1 -0
  116. package/stable/array/virtual/push.js +3 -0
  117. package/stable/array/virtual/unshift.js +3 -0
  118. package/stable/index.js +6 -0
  119. package/stable/instance/find-last-index.js +3 -0
  120. package/stable/instance/find-last.js +3 -0
  121. package/stable/instance/push.js +3 -0
  122. package/stable/instance/unshift.js +3 -0
  123. package/stable/typed-array/find-last-index.js +1 -0
  124. package/stable/typed-array/find-last.js +1 -0
  125. package/stage/2.js +2 -1
  126. package/stage/3.js +3 -1
@@ -15,7 +15,10 @@ var getPrototypeOf = require('../internals/object-get-prototype-of');
15
15
  var setPrototypeOf = require('../internals/object-set-prototype-of');
16
16
  var wellKnownSymbol = require('../internals/well-known-symbol');
17
17
  var uid = require('../internals/uid');
18
+ var InternalStateModule = require('../internals/internal-state');
18
19
 
20
+ var enforceInternalState = InternalStateModule.enforce;
21
+ var getInternalState = InternalStateModule.get;
19
22
  var Int8Array = global.Int8Array;
20
23
  var Int8ArrayPrototype = Int8Array && Int8Array.prototype;
21
24
  var Uint8ClampedArray = global.Uint8ClampedArray;
@@ -27,7 +30,7 @@ var TypeError = global.TypeError;
27
30
 
28
31
  var TO_STRING_TAG = wellKnownSymbol('toStringTag');
29
32
  var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG');
30
- var TYPED_ARRAY_CONSTRUCTOR = uid('TYPED_ARRAY_CONSTRUCTOR');
33
+ var TYPED_ARRAY_CONSTRUCTOR = 'TypedArrayConstructor';
31
34
  // Fixing native typed arrays in Opera Presto crashes the browser, see #595
32
35
  var NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(global.opera) !== 'Opera';
33
36
  var TYPED_ARRAY_TAG_REQUIRED = false;
@@ -58,6 +61,13 @@ var isView = function isView(it) {
58
61
  || hasOwn(BigIntArrayConstructorsList, klass);
59
62
  };
60
63
 
64
+ var getTypedArrayConstructor = function (it) {
65
+ var proto = getPrototypeOf(it);
66
+ if (!isObject(proto)) return;
67
+ var state = getInternalState(proto);
68
+ return (state && hasOwn(state, TYPED_ARRAY_CONSTRUCTOR)) ? state[TYPED_ARRAY_CONSTRUCTOR] : getTypedArrayConstructor(proto);
69
+ };
70
+
61
71
  var isTypedArray = function (it) {
62
72
  if (!isObject(it)) return false;
63
73
  var klass = classof(it);
@@ -122,14 +132,14 @@ var exportTypedArrayStaticMethod = function (KEY, property, forced) {
122
132
  for (NAME in TypedArrayConstructorsList) {
123
133
  Constructor = global[NAME];
124
134
  Prototype = Constructor && Constructor.prototype;
125
- if (Prototype) createNonEnumerableProperty(Prototype, TYPED_ARRAY_CONSTRUCTOR, Constructor);
135
+ if (Prototype) enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor;
126
136
  else NATIVE_ARRAY_BUFFER_VIEWS = false;
127
137
  }
128
138
 
129
139
  for (NAME in BigIntArrayConstructorsList) {
130
140
  Constructor = global[NAME];
131
141
  Prototype = Constructor && Constructor.prototype;
132
- if (Prototype) createNonEnumerableProperty(Prototype, TYPED_ARRAY_CONSTRUCTOR, Constructor);
142
+ if (Prototype) enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor;
133
143
  }
134
144
 
135
145
  // WebKit bug - typed arrays constructors prototype is Object.prototype
@@ -167,12 +177,12 @@ if (DESCRIPTORS && !hasOwn(TypedArrayPrototype, TO_STRING_TAG)) {
167
177
 
168
178
  module.exports = {
169
179
  NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS,
170
- TYPED_ARRAY_CONSTRUCTOR: TYPED_ARRAY_CONSTRUCTOR,
171
180
  TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQUIRED && TYPED_ARRAY_TAG,
172
181
  aTypedArray: aTypedArray,
173
182
  aTypedArrayConstructor: aTypedArrayConstructor,
174
183
  exportTypedArrayMethod: exportTypedArrayMethod,
175
184
  exportTypedArrayStaticMethod: exportTypedArrayStaticMethod,
185
+ getTypedArrayConstructor: getTypedArrayConstructor,
176
186
  isView: isView,
177
187
  isTypedArray: isTypedArray,
178
188
  TypedArray: TypedArray,
@@ -0,0 +1,32 @@
1
+ 'use strict';
2
+ var getBuiltIn = require('../internals/get-built-in');
3
+ var bind = require('../internals/function-bind-context');
4
+ var uncurryThis = require('../internals/function-uncurry-this');
5
+ var IndexedObject = require('../internals/indexed-object');
6
+ var toObject = require('../internals/to-object');
7
+ var lengthOfArrayLike = require('../internals/length-of-array-like');
8
+
9
+ var Map = getBuiltIn('Map');
10
+ var MapPrototype = Map.prototype;
11
+ var mapGet = uncurryThis(MapPrototype.get);
12
+ var mapHas = uncurryThis(MapPrototype.has);
13
+ var mapSet = uncurryThis(MapPrototype.set);
14
+ var push = uncurryThis([].push);
15
+
16
+ // `Array.prototype.groupToMap` method
17
+ // https://github.com/tc39/proposal-array-grouping
18
+ module.exports = function groupToMap(callbackfn /* , thisArg */) {
19
+ var O = toObject(this);
20
+ var self = IndexedObject(O);
21
+ var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
22
+ var map = new Map();
23
+ var length = lengthOfArrayLike(self);
24
+ var index = 0;
25
+ var key, value;
26
+ for (;length > index; index++) {
27
+ value = self[index];
28
+ key = boundFunction(value, index, O);
29
+ if (mapHas(map, key)) push(mapGet(map, key), value);
30
+ else mapSet(map, key, [value]);
31
+ } return map;
32
+ };
File without changes
@@ -1,5 +1,5 @@
1
1
  var isCallable = require('../internals/is-callable');
2
- var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
2
+ var definePropertyModule = require('../internals/object-define-property');
3
3
  var makeBuiltIn = require('../internals/make-built-in');
4
4
  var defineGlobalProperty = require('../internals/define-global-property');
5
5
 
@@ -15,6 +15,11 @@ module.exports = function (O, key, value, options) {
15
15
  if (!options.unsafe) delete O[key];
16
16
  else if (O[key]) simple = true;
17
17
  if (simple) O[key] = value;
18
- else createNonEnumerableProperty(O, key, value);
18
+ else definePropertyModule.f(O, key, {
19
+ value: value,
20
+ enumerable: false,
21
+ configurable: !options.nonConfigurable,
22
+ writable: !options.nonWritable
23
+ });
19
24
  } return O;
20
25
  };
@@ -0,0 +1,2 @@
1
+ /* global Deno -- Deno case */
2
+ module.exports = typeof Deno == 'object' && Deno && typeof Deno.version == 'object';
@@ -12,6 +12,7 @@ module.exports = function () {
12
12
  if (that.multiline) result += 'm';
13
13
  if (that.dotAll) result += 's';
14
14
  if (that.unicode) result += 'u';
15
+ if (that.unicodeSets) result += 'v';
15
16
  if (that.sticky) result += 'y';
16
17
  return result;
17
18
  };
@@ -4,9 +4,9 @@ var store = require('../internals/shared-store');
4
4
  (module.exports = function (key, value) {
5
5
  return store[key] || (store[key] = value !== undefined ? value : {});
6
6
  })('versions', []).push({
7
- version: '3.22.8',
7
+ version: '3.23.2',
8
8
  mode: IS_PURE ? 'pure' : 'global',
9
9
  copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
10
- license: 'https://github.com/zloirock/core-js/blob/v3.22.8/LICENSE',
10
+ license: 'https://github.com/zloirock/core-js/blob/v3.23.2/LICENSE',
11
11
  source: 'https://github.com/zloirock/core-js'
12
12
  });
@@ -32,6 +32,7 @@ var inheritIfRequired = require('../internals/inherit-if-required');
32
32
 
33
33
  var getInternalState = InternalStateModule.get;
34
34
  var setInternalState = InternalStateModule.set;
35
+ var enforceInternalState = InternalStateModule.enforce;
35
36
  var nativeDefineProperty = definePropertyModule.f;
36
37
  var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
37
38
  var round = Math.round;
@@ -40,7 +41,6 @@ var ArrayBuffer = ArrayBufferModule.ArrayBuffer;
40
41
  var ArrayBufferPrototype = ArrayBuffer.prototype;
41
42
  var DataView = ArrayBufferModule.DataView;
42
43
  var NATIVE_ARRAY_BUFFER_VIEWS = ArrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS;
43
- var TYPED_ARRAY_CONSTRUCTOR = ArrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR;
44
44
  var TYPED_ARRAY_TAG = ArrayBufferViewCore.TYPED_ARRAY_TAG;
45
45
  var TypedArray = ArrayBufferViewCore.TypedArray;
46
46
  var TypedArrayPrototype = ArrayBufferViewCore.TypedArrayPrototype;
@@ -217,7 +217,7 @@ if (DESCRIPTORS) {
217
217
  createNonEnumerableProperty(TypedArrayConstructorPrototype, 'constructor', TypedArrayConstructor);
218
218
  }
219
219
 
220
- createNonEnumerableProperty(TypedArrayConstructorPrototype, TYPED_ARRAY_CONSTRUCTOR, TypedArrayConstructor);
220
+ enforceInternalState(TypedArrayConstructorPrototype).TypedArrayConstructor = TypedArrayConstructor;
221
221
 
222
222
  if (TYPED_ARRAY_TAG) {
223
223
  createNonEnumerableProperty(TypedArrayConstructorPrototype, TYPED_ARRAY_TAG, CONSTRUCTOR_NAME);
@@ -1,11 +1,11 @@
1
1
  var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
2
2
  var speciesConstructor = require('../internals/species-constructor');
3
3
 
4
- var TYPED_ARRAY_CONSTRUCTOR = ArrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR;
5
4
  var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor;
5
+ var getTypedArrayConstructor = ArrayBufferViewCore.getTypedArrayConstructor;
6
6
 
7
7
  // a part of `TypedArraySpeciesCreate` abstract operation
8
8
  // https://tc39.es/ecma262/#typedarray-species-create
9
9
  module.exports = function (originalArray) {
10
- return aTypedArrayConstructor(speciesConstructor(originalArray, originalArray[TYPED_ARRAY_CONSTRUCTOR]));
10
+ return aTypedArrayConstructor(speciesConstructor(originalArray, getTypedArrayConstructor(originalArray)));
11
11
  };
@@ -0,0 +1,14 @@
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');
@@ -0,0 +1,14 @@
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');
@@ -0,0 +1,39 @@
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 doesNotExceedSafeInteger = require('../internals/does-not-exceed-safe-integer');
6
+ var fails = require('../internals/fails');
7
+
8
+ var INCORRECT_TO_LENGTH = fails(function () {
9
+ return [].push.call({ length: 0x100000000 }, 1) !== 4294967297;
10
+ });
11
+
12
+ // V8 and Safari <= 15.4, FF < 23 throws InternalError
13
+ // https://bugs.chromium.org/p/v8/issues/detail?id=12681
14
+ var SILENT_ON_NON_WRITABLE_LENGTH = !function () {
15
+ try {
16
+ // eslint-disable-next-line es-x/no-object-defineproperty -- safe
17
+ Object.defineProperty([], 'length', { writable: false }).push();
18
+ } catch (error) {
19
+ return error instanceof TypeError;
20
+ }
21
+ }();
22
+
23
+ // `Array.prototype.push` method
24
+ // https://tc39.es/ecma262/#sec-array.prototype.push
25
+ $({ target: 'Array', proto: true, arity: 1, forced: INCORRECT_TO_LENGTH || SILENT_ON_NON_WRITABLE_LENGTH }, {
26
+ // eslint-disable-next-line no-unused-vars -- required for `.length`
27
+ push: function push(item) {
28
+ var O = toObject(this);
29
+ var len = lengthOfArrayLike(O);
30
+ var argCount = arguments.length;
31
+ doesNotExceedSafeInteger(len + argCount);
32
+ for (var i = 0; i < argCount; i++) {
33
+ O[len] = arguments[i];
34
+ len++;
35
+ }
36
+ O.length = len;
37
+ return len;
38
+ }
39
+ });
@@ -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
+ });
@@ -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,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
@@ -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');
@@ -2,6 +2,6 @@ var $ = require('../internals/export');
2
2
 
3
3
  // `Math.DEG_PER_RAD` constant
4
4
  // https://rwaldron.github.io/proposal-math-extensions/
5
- $({ target: 'Math', stat: true, forced: true }, {
5
+ $({ target: 'Math', stat: true, nonConfigurable: true, nonWritable: true }, {
6
6
  DEG_PER_RAD: Math.PI / 180
7
7
  });
@@ -2,6 +2,6 @@ var $ = require('../internals/export');
2
2
 
3
3
  // `Math.RAD_PER_DEG` constant
4
4
  // https://rwaldron.github.io/proposal-math-extensions/
5
- $({ target: 'Math', stat: true, forced: true }, {
5
+ $({ target: 'Math', stat: true, nonConfigurable: true, nonWritable: true }, {
6
6
  RAD_PER_DEG: 180 / Math.PI
7
7
  });
@@ -0,0 +1,5 @@
1
+ var defineWellKnownSymbol = require('../internals/define-well-known-symbol');
2
+
3
+ // `Symbol.metadataKey` well-known symbol
4
+ // https://github.com/tc39/proposal-decorator-metadata
5
+ defineWellKnownSymbol('metadataKey');
@@ -1,3 +1,4 @@
1
+ // TODO: Remove from `core-js@4`
1
2
  var defineWellKnownSymbol = require('../internals/define-well-known-symbol');
2
3
 
3
4
  // `Symbol.metadata` well-known symbol
@@ -1,12 +1,2 @@
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
- });
1
+ // TODO: Remove from `core-js@4`
2
+ require('../modules/es.typed-array.find-last-index');
@@ -1,12 +1,2 @@
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
+ // TODO: Remove from `core-js@4`
2
+ require('../modules/es.typed-array.find-last');
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
  // TODO: Remove from `core-js@4`
3
3
  var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
4
- var $groupBy = require('../internals/array-group-by');
4
+ var $group = require('../internals/array-group');
5
5
  var typedArraySpeciesConstructor = require('../internals/typed-array-species-constructor');
6
6
 
7
7
  var aTypedArray = ArrayBufferViewCore.aTypedArray;
@@ -11,5 +11,5 @@ var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
11
11
  // https://github.com/tc39/proposal-array-grouping
12
12
  exportTypedArrayMethod('groupBy', function groupBy(callbackfn /* , thisArg */) {
13
13
  var thisArg = arguments.length > 1 ? arguments[1] : undefined;
14
- return $groupBy(aTypedArray(this), callbackfn, thisArg, typedArraySpeciesConstructor);
14
+ return $group(aTypedArray(this), callbackfn, thisArg, typedArraySpeciesConstructor);
15
15
  }, true);
@@ -4,10 +4,10 @@ var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
4
4
 
5
5
  var aTypedArray = ArrayBufferViewCore.aTypedArray;
6
6
  var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
7
- var TYPED_ARRAY_CONSTRUCTOR = ArrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR;
7
+ var getTypedArrayConstructor = ArrayBufferViewCore.getTypedArrayConstructor;
8
8
 
9
9
  // `%TypedArray%.prototype.toReversed` method
10
10
  // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toReversed
11
11
  exportTypedArrayMethod('toReversed', function toReversed() {
12
- return arrayToReversed(aTypedArray(this), this[TYPED_ARRAY_CONSTRUCTOR]);
12
+ return arrayToReversed(aTypedArray(this), getTypedArrayConstructor(this));
13
13
  });