core-js 3.33.3 → 3.35.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 (98) hide show
  1. package/actual/map/group-by.js +2 -10
  2. package/actual/object/group-by.js +2 -4
  3. package/actual/promise/with-resolvers.js +3 -10
  4. package/es/index.js +3 -0
  5. package/es/map/group-by.js +13 -0
  6. package/es/map/index.js +1 -0
  7. package/es/object/group-by.js +7 -0
  8. package/es/object/index.js +1 -0
  9. package/es/promise/index.js +1 -0
  10. package/es/promise/with-resolvers.js +13 -0
  11. package/features/typed-array/from-base64.js +2 -0
  12. package/features/typed-array/from-hex.js +2 -0
  13. package/features/typed-array/to-base64.js +2 -0
  14. package/features/typed-array/to-hex.js +2 -0
  15. package/full/index.js +7 -0
  16. package/full/typed-array/from-base64.js +2 -0
  17. package/full/typed-array/from-hex.js +2 -0
  18. package/full/typed-array/index.js +4 -0
  19. package/full/typed-array/methods.js +4 -0
  20. package/full/typed-array/to-base64.js +2 -0
  21. package/full/typed-array/to-hex.js +2 -0
  22. package/internals/a-data-view.js +9 -0
  23. package/internals/a-possible-prototype.js +2 -2
  24. package/internals/a-string.js +7 -0
  25. package/internals/an-object-or-undefined.js +10 -0
  26. package/internals/an-uint8-array.js +11 -0
  27. package/internals/array-buffer.js +6 -9
  28. package/internals/array-from-constructor-and-list.js +2 -2
  29. package/internals/array-iteration-from-last.js +1 -1
  30. package/internals/array-iteration.js +1 -1
  31. package/internals/array-reduce.js +1 -1
  32. package/internals/array-sort.js +30 -33
  33. package/internals/base64-map.js +14 -5
  34. package/internals/collection-from.js +17 -24
  35. package/internals/collection-of.js +11 -3
  36. package/internals/collection-strong.js +1 -2
  37. package/internals/get-alphabet-option.js +8 -0
  38. package/internals/get-set-record.js +5 -10
  39. package/internals/is-callable.js +4 -4
  40. package/internals/is-object.js +1 -6
  41. package/internals/is-possible-prototype.js +6 -0
  42. package/internals/microtask.js +2 -4
  43. package/internals/object-get-own-property-names-external.js +1 -1
  44. package/internals/safe-get-built-in.js +13 -0
  45. package/internals/shared.js +2 -2
  46. package/internals/typed-array-constructor.js +3 -12
  47. package/modules/es.array.push.js +1 -1
  48. package/modules/es.function.has-instance.js +2 -5
  49. package/modules/es.map.group-by.js +31 -0
  50. package/modules/es.object.group-by.js +30 -0
  51. package/modules/es.object.proto.js +4 -2
  52. package/modules/es.promise.reject.js +2 -2
  53. package/modules/es.promise.with-resolvers.js +16 -0
  54. package/modules/es.regexp.constructor.js +2 -1
  55. package/modules/es.regexp.dot-all.js +1 -1
  56. package/modules/es.regexp.to-string.js +1 -1
  57. package/modules/es.string.ends-with.js +1 -5
  58. package/modules/es.string.split.js +1 -1
  59. package/modules/es.string.starts-with.js +1 -5
  60. package/modules/es.symbol.constructor.js +1 -1
  61. package/modules/es.weak-map.constructor.js +3 -6
  62. package/modules/esnext.data-view.set-float16.js +2 -3
  63. package/modules/esnext.data-view.set-uint8-clamped.js +2 -3
  64. package/modules/esnext.iterator.constructor.js +27 -7
  65. package/modules/esnext.map.from.js +3 -2
  66. package/modules/esnext.map.group-by.js +2 -30
  67. package/modules/esnext.map.of.js +3 -2
  68. package/modules/esnext.number.from-string.js +1 -1
  69. package/modules/esnext.object.group-by.js +2 -29
  70. package/modules/esnext.promise.with-resolvers.js +2 -15
  71. package/modules/esnext.set.from.js +3 -2
  72. package/modules/esnext.set.of.js +3 -2
  73. package/modules/esnext.string.dedent.js +1 -1
  74. package/modules/esnext.uint8-array.from-base64.js +75 -0
  75. package/modules/esnext.uint8-array.from-hex.js +28 -0
  76. package/modules/esnext.uint8-array.to-base64.js +47 -0
  77. package/modules/esnext.uint8-array.to-hex.js +22 -0
  78. package/modules/esnext.weak-map.from.js +3 -2
  79. package/modules/esnext.weak-map.of.js +3 -2
  80. package/modules/esnext.weak-set.from.js +3 -2
  81. package/modules/esnext.weak-set.of.js +3 -2
  82. package/modules/web.atob.js +20 -15
  83. package/modules/web.btoa.js +11 -7
  84. package/modules/web.dom-collections.iterator.js +2 -4
  85. package/modules/web.queue-microtask.js +1 -7
  86. package/modules/web.url-search-params.constructor.js +1 -9
  87. package/modules/web.url.constructor.js +1 -1
  88. package/package.json +1 -1
  89. package/proposals/array-buffer-base64.js +6 -0
  90. package/stable/index.js +3 -0
  91. package/stable/map/group-by.js +4 -0
  92. package/stable/object/group-by.js +4 -0
  93. package/stable/promise/with-resolvers.js +4 -0
  94. package/stage/2.js +1 -0
  95. package/stage/3.js +0 -2
  96. package/stage/4.js +2 -0
  97. package/internals/array-slice-simple.js +0 -18
  98. package/internals/document-all.js +0 -11
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
  var global = require('../internals/global');
3
+ var safeGetBuiltIn = require('../internals/safe-get-built-in');
3
4
  var bind = require('../internals/function-bind-context');
4
- var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
5
5
  var macrotask = require('../internals/task').set;
6
6
  var Queue = require('../internals/queue');
7
7
  var IS_IOS = require('../internals/engine-is-ios');
@@ -13,9 +13,7 @@ var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
13
13
  var document = global.document;
14
14
  var process = global.process;
15
15
  var Promise = global.Promise;
16
- // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
17
- var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');
18
- var microtask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
16
+ var microtask = safeGetBuiltIn('queueMicrotask');
19
17
  var notify, toggle, node, promise, then;
20
18
 
21
19
  // modern engines have queueMicrotask method
@@ -3,7 +3,7 @@
3
3
  var classof = require('../internals/classof-raw');
4
4
  var toIndexedObject = require('../internals/to-indexed-object');
5
5
  var $getOwnPropertyNames = require('../internals/object-get-own-property-names').f;
6
- var arraySlice = require('../internals/array-slice-simple');
6
+ var arraySlice = require('../internals/array-slice');
7
7
 
8
8
  var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
9
9
  ? Object.getOwnPropertyNames(window) : [];
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+ var global = require('../internals/global');
3
+ var DESCRIPTORS = require('../internals/descriptors');
4
+
5
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
6
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
7
+
8
+ // Avoid NodeJS experimental warning
9
+ module.exports = function (name) {
10
+ if (!DESCRIPTORS) return global[name];
11
+ var descriptor = getOwnPropertyDescriptor(global, name);
12
+ return descriptor && descriptor.value;
13
+ };
@@ -5,9 +5,9 @@ var store = require('../internals/shared-store');
5
5
  (module.exports = function (key, value) {
6
6
  return store[key] || (store[key] = value !== undefined ? value : {});
7
7
  })('versions', []).push({
8
- version: '3.33.3',
8
+ version: '3.35.0',
9
9
  mode: IS_PURE ? 'pure' : 'global',
10
10
  copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)',
11
- license: 'https://github.com/zloirock/core-js/blob/v3.33.3/LICENSE',
11
+ license: 'https://github.com/zloirock/core-js/blob/v3.35.0/LICENSE',
12
12
  source: 'https://github.com/zloirock/core-js'
13
13
  });
@@ -29,6 +29,7 @@ var setSpecies = require('../internals/set-species');
29
29
  var defineBuiltInAccessor = require('../internals/define-built-in-accessor');
30
30
  var definePropertyModule = require('../internals/object-define-property');
31
31
  var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');
32
+ var arrayFromConstructorAndList = require('../internals/array-from-constructor-and-list');
32
33
  var InternalStateModule = require('../internals/internal-state');
33
34
  var inheritIfRequired = require('../internals/inherit-if-required');
34
35
 
@@ -45,20 +46,10 @@ var NATIVE_ARRAY_BUFFER_VIEWS = ArrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS;
45
46
  var TYPED_ARRAY_TAG = ArrayBufferViewCore.TYPED_ARRAY_TAG;
46
47
  var TypedArray = ArrayBufferViewCore.TypedArray;
47
48
  var TypedArrayPrototype = ArrayBufferViewCore.TypedArrayPrototype;
48
- var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor;
49
49
  var isTypedArray = ArrayBufferViewCore.isTypedArray;
50
50
  var BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT';
51
51
  var WRONG_LENGTH = 'Wrong length';
52
52
 
53
- var fromList = function (C, list) {
54
- aTypedArrayConstructor(C);
55
- var index = 0;
56
- var length = list.length;
57
- var result = new C(length);
58
- while (length > index) result[index] = list[index++];
59
- return result;
60
- };
61
-
62
53
  var addGetter = function (it, key) {
63
54
  defineBuiltInAccessor(it, key, {
64
55
  configurable: true,
@@ -176,7 +167,7 @@ if (DESCRIPTORS) {
176
167
  }
177
168
  length = byteLength / BYTES;
178
169
  } else if (isTypedArray(data)) {
179
- return fromList(TypedArrayConstructor, data);
170
+ return arrayFromConstructorAndList(TypedArrayConstructor, data);
180
171
  } else {
181
172
  return call(typedArrayFrom, TypedArrayConstructor, data);
182
173
  }
@@ -202,7 +193,7 @@ if (DESCRIPTORS) {
202
193
  : typedArrayOffset !== undefined
203
194
  ? new NativeTypedArrayConstructor(data, toOffset(typedArrayOffset, BYTES))
204
195
  : new NativeTypedArrayConstructor(data);
205
- if (isTypedArray(data)) return fromList(TypedArrayConstructor, data);
196
+ if (isTypedArray(data)) return arrayFromConstructorAndList(TypedArrayConstructor, data);
206
197
  return call(typedArrayFrom, TypedArrayConstructor, data);
207
198
  }(), dummy, TypedArrayConstructor);
208
199
  });
@@ -10,7 +10,7 @@ var INCORRECT_TO_LENGTH = fails(function () {
10
10
  return [].push.call({ length: 0x100000000 }, 1) !== 4294967297;
11
11
  });
12
12
 
13
- // V8 and Safari <= 15.4, FF < 23 throws InternalError
13
+ // V8 <= 121 and Safari <= 15.4; FF < 23 throws InternalError
14
14
  // https://bugs.chromium.org/p/v8/issues/detail?id=12681
15
15
  var properErrorOnNonWritableLength = function () {
16
16
  try {
@@ -2,7 +2,7 @@
2
2
  var isCallable = require('../internals/is-callable');
3
3
  var isObject = require('../internals/is-object');
4
4
  var definePropertyModule = require('../internals/object-define-property');
5
- var getPrototypeOf = require('../internals/object-get-prototype-of');
5
+ var isPrototypeOf = require('../internals/object-is-prototype-of');
6
6
  var wellKnownSymbol = require('../internals/well-known-symbol');
7
7
  var makeBuiltIn = require('../internals/make-built-in');
8
8
 
@@ -15,9 +15,6 @@ if (!(HAS_INSTANCE in FunctionPrototype)) {
15
15
  definePropertyModule.f(FunctionPrototype, HAS_INSTANCE, { value: makeBuiltIn(function (O) {
16
16
  if (!isCallable(this) || !isObject(O)) return false;
17
17
  var P = this.prototype;
18
- if (!isObject(P)) return O instanceof this;
19
- // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this:
20
- while (O = getPrototypeOf(O)) if (P === O) return true;
21
- return false;
18
+ return isObject(P) ? isPrototypeOf(P, O) : O instanceof this;
22
19
  }, HAS_INSTANCE) });
23
20
  }
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+ var $ = require('../internals/export');
3
+ var uncurryThis = require('../internals/function-uncurry-this');
4
+ var aCallable = require('../internals/a-callable');
5
+ var requireObjectCoercible = require('../internals/require-object-coercible');
6
+ var iterate = require('../internals/iterate');
7
+ var MapHelpers = require('../internals/map-helpers');
8
+ var IS_PURE = require('../internals/is-pure');
9
+
10
+ var Map = MapHelpers.Map;
11
+ var has = MapHelpers.has;
12
+ var get = MapHelpers.get;
13
+ var set = MapHelpers.set;
14
+ var push = uncurryThis([].push);
15
+
16
+ // `Map.groupBy` method
17
+ // https://github.com/tc39/proposal-array-grouping
18
+ $({ target: 'Map', stat: true, forced: IS_PURE }, {
19
+ groupBy: function groupBy(items, callbackfn) {
20
+ requireObjectCoercible(items);
21
+ aCallable(callbackfn);
22
+ var map = new Map();
23
+ var k = 0;
24
+ iterate(items, function (value) {
25
+ var key = callbackfn(value, k++);
26
+ if (!has(map, key)) set(map, key, [value]);
27
+ else push(get(map, key), value);
28
+ });
29
+ return map;
30
+ }
31
+ });
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+ var $ = require('../internals/export');
3
+ var getBuiltIn = require('../internals/get-built-in');
4
+ var uncurryThis = require('../internals/function-uncurry-this');
5
+ var aCallable = require('../internals/a-callable');
6
+ var requireObjectCoercible = require('../internals/require-object-coercible');
7
+ var toPropertyKey = require('../internals/to-property-key');
8
+ var iterate = require('../internals/iterate');
9
+
10
+ var create = getBuiltIn('Object', 'create');
11
+ var push = uncurryThis([].push);
12
+
13
+ // `Object.groupBy` method
14
+ // https://github.com/tc39/proposal-array-grouping
15
+ $({ target: 'Object', stat: true }, {
16
+ groupBy: function groupBy(items, callbackfn) {
17
+ requireObjectCoercible(items);
18
+ aCallable(callbackfn);
19
+ var obj = create(null);
20
+ var k = 0;
21
+ iterate(items, function (value) {
22
+ var key = toPropertyKey(callbackfn(value, k++));
23
+ // in some IE versions, `hasOwnProperty` returns incorrect result on integer keys
24
+ // but since it's a `null` prototype object, we can safely use `in`
25
+ if (key in obj) push(obj[key], value);
26
+ else obj[key] = [value];
27
+ });
28
+ return obj;
29
+ }
30
+ });
@@ -2,6 +2,7 @@
2
2
  var DESCRIPTORS = require('../internals/descriptors');
3
3
  var defineBuiltInAccessor = require('../internals/define-built-in-accessor');
4
4
  var isObject = require('../internals/is-object');
5
+ var isPossiblePrototype = require('../internals/is-possible-prototype');
5
6
  var toObject = require('../internals/to-object');
6
7
  var requireObjectCoercible = require('../internals/require-object-coercible');
7
8
 
@@ -22,8 +23,9 @@ if (DESCRIPTORS && getPrototypeOf && setPrototypeOf && !(PROTO in ObjectPrototyp
22
23
  },
23
24
  set: function __proto__(proto) {
24
25
  var O = requireObjectCoercible(this);
25
- if (!isObject(proto) && proto !== null || !isObject(O)) return;
26
- setPrototypeOf(O, proto);
26
+ if (isPossiblePrototype(proto) && isObject(O)) {
27
+ setPrototypeOf(O, proto);
28
+ }
27
29
  }
28
30
  });
29
31
  } catch (error) { /* empty */ }
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
- var call = require('../internals/function-call');
4
3
  var newPromiseCapabilityModule = require('../internals/new-promise-capability');
5
4
  var FORCED_PROMISE_CONSTRUCTOR = require('../internals/promise-constructor-detection').CONSTRUCTOR;
6
5
 
@@ -9,7 +8,8 @@ var FORCED_PROMISE_CONSTRUCTOR = require('../internals/promise-constructor-detec
9
8
  $({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
10
9
  reject: function reject(r) {
11
10
  var capability = newPromiseCapabilityModule.f(this);
12
- call(capability.reject, undefined, r);
11
+ var capabilityReject = capability.reject;
12
+ capabilityReject(r);
13
13
  return capability.promise;
14
14
  }
15
15
  });
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+ var $ = require('../internals/export');
3
+ var newPromiseCapabilityModule = require('../internals/new-promise-capability');
4
+
5
+ // `Promise.withResolvers` method
6
+ // https://github.com/tc39/proposal-promise-with-resolvers
7
+ $({ target: 'Promise', stat: true }, {
8
+ withResolvers: function withResolvers() {
9
+ var promiseCapability = newPromiseCapabilityModule.f(this);
10
+ return {
11
+ promise: promiseCapability.promise,
12
+ resolve: promiseCapability.resolve,
13
+ reject: promiseCapability.reject
14
+ };
15
+ }
16
+ });
@@ -5,6 +5,7 @@ var uncurryThis = require('../internals/function-uncurry-this');
5
5
  var isForced = require('../internals/is-forced');
6
6
  var inheritIfRequired = require('../internals/inherit-if-required');
7
7
  var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
8
+ var create = require('../internals/object-create');
8
9
  var getOwnPropertyNames = require('../internals/object-get-own-property-names').f;
9
10
  var isPrototypeOf = require('../internals/object-is-prototype-of');
10
11
  var isRegExp = require('../internals/is-regexp');
@@ -77,7 +78,7 @@ var handleNCG = function (string) {
77
78
  var index = 0;
78
79
  var result = '';
79
80
  var named = [];
80
- var names = {};
81
+ var names = create(null);
81
82
  var brackets = false;
82
83
  var ncg = false;
83
84
  var groupid = 0;
@@ -14,7 +14,7 @@ if (DESCRIPTORS && UNSUPPORTED_DOT_ALL) {
14
14
  defineBuiltInAccessor(RegExpPrototype, 'dotAll', {
15
15
  configurable: true,
16
16
  get: function dotAll() {
17
- if (this === RegExpPrototype) return undefined;
17
+ if (this === RegExpPrototype) return;
18
18
  // We can't use InternalStateModule.getterFor because
19
19
  // we don't add metadata for regexps created by a literal.
20
20
  if (classof(this) === 'RegExp') {
@@ -17,7 +17,7 @@ var INCORRECT_NAME = PROPER_FUNCTION_NAME && nativeToString.name !== TO_STRING;
17
17
  // `RegExp.prototype.toString` method
18
18
  // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
19
19
  if (NOT_GENERIC || INCORRECT_NAME) {
20
- defineBuiltIn(RegExp.prototype, TO_STRING, function toString() {
20
+ defineBuiltIn(RegExpPrototype, TO_STRING, function toString() {
21
21
  var R = anObject(this);
22
22
  var pattern = $toString(R.source);
23
23
  var flags = $toString(getRegExpFlags(R));
@@ -9,8 +9,6 @@ var requireObjectCoercible = require('../internals/require-object-coercible');
9
9
  var correctIsRegExpLogic = require('../internals/correct-is-regexp-logic');
10
10
  var IS_PURE = require('../internals/is-pure');
11
11
 
12
- // eslint-disable-next-line es/no-string-prototype-endswith -- safe
13
- var nativeEndsWith = uncurryThis(''.endsWith);
14
12
  var slice = uncurryThis(''.slice);
15
13
  var min = Math.min;
16
14
 
@@ -31,8 +29,6 @@ $({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGE
31
29
  var len = that.length;
32
30
  var end = endPosition === undefined ? len : min(toLength(endPosition), len);
33
31
  var search = toString(searchString);
34
- return nativeEndsWith
35
- ? nativeEndsWith(that, search, end)
36
- : slice(that, end - search.length, end) === search;
32
+ return slice(that, end - search.length, end) === search;
37
33
  }
38
34
  });
@@ -12,7 +12,7 @@ var advanceStringIndex = require('../internals/advance-string-index');
12
12
  var toLength = require('../internals/to-length');
13
13
  var toString = require('../internals/to-string');
14
14
  var getMethod = require('../internals/get-method');
15
- var arraySlice = require('../internals/array-slice-simple');
15
+ var arraySlice = require('../internals/array-slice');
16
16
  var callRegExpExec = require('../internals/regexp-exec-abstract');
17
17
  var regexpExec = require('../internals/regexp-exec');
18
18
  var stickyHelpers = require('../internals/regexp-sticky-helpers');
@@ -9,8 +9,6 @@ var requireObjectCoercible = require('../internals/require-object-coercible');
9
9
  var correctIsRegExpLogic = require('../internals/correct-is-regexp-logic');
10
10
  var IS_PURE = require('../internals/is-pure');
11
11
 
12
- // eslint-disable-next-line es/no-string-prototype-startswith -- safe
13
- var nativeStartsWith = uncurryThis(''.startsWith);
14
12
  var stringSlice = uncurryThis(''.slice);
15
13
  var min = Math.min;
16
14
 
@@ -29,8 +27,6 @@ $({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGE
29
27
  notARegExp(searchString);
30
28
  var index = toLength(min(arguments.length > 1 ? arguments[1] : undefined, that.length));
31
29
  var search = toString(searchString);
32
- return nativeStartsWith
33
- ? nativeStartsWith(that, search, index)
34
- : stringSlice(that, index, index + search.length) === search;
30
+ return stringSlice(that, index, index + search.length) === search;
35
31
  }
36
32
  });
@@ -97,7 +97,7 @@ var $defineProperty = function defineProperty(O, P, Attributes) {
97
97
  anObject(Attributes);
98
98
  if (hasOwn(AllSymbols, key)) {
99
99
  if (!Attributes.enumerable) {
100
- if (!hasOwn(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {}));
100
+ if (!hasOwn(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, nativeObjectCreate(null)));
101
101
  O[HIDDEN][key] = true;
102
102
  } else {
103
103
  if (hasOwn(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
@@ -25,8 +25,6 @@ var freeze = $Object.freeze;
25
25
  // eslint-disable-next-line es/no-object-seal -- safe
26
26
  var seal = $Object.seal;
27
27
 
28
- var FROZEN = {};
29
- var SEALED = {};
30
28
  var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;
31
29
  var InternalWeakMap;
32
30
 
@@ -97,12 +95,11 @@ if (NATIVE_WEAK_MAP) if (IS_IE11) {
97
95
  set: function set(key, value) {
98
96
  var arrayIntegrityLevel;
99
97
  if (isArray(key)) {
100
- if (isFrozen(key)) arrayIntegrityLevel = FROZEN;
101
- else if (isSealed(key)) arrayIntegrityLevel = SEALED;
98
+ if (isFrozen(key)) arrayIntegrityLevel = freeze;
99
+ else if (isSealed(key)) arrayIntegrityLevel = seal;
102
100
  }
103
101
  nativeSet(this, key, value);
104
- if (arrayIntegrityLevel === FROZEN) freeze(key);
105
- if (arrayIntegrityLevel === SEALED) seal(key);
102
+ if (arrayIntegrityLevel) arrayIntegrityLevel(key);
106
103
  return this;
107
104
  }
108
105
  });
@@ -1,12 +1,11 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
3
  var uncurryThis = require('../internals/function-uncurry-this');
4
- var classof = require('../internals/classof');
4
+ var aDataView = require('../internals/a-data-view');
5
5
  var toIndex = require('../internals/to-index');
6
6
  var packIEEE754 = require('../internals/ieee754').pack;
7
7
  var f16round = require('../internals/math-f16round');
8
8
 
9
- var $TypeError = TypeError;
10
9
  // eslint-disable-next-line es/no-typed-arrays -- safe
11
10
  var setUint16 = uncurryThis(DataView.prototype.setUint16);
12
11
 
@@ -14,7 +13,7 @@ var setUint16 = uncurryThis(DataView.prototype.setUint16);
14
13
  // https://github.com/tc39/proposal-float16array
15
14
  $({ target: 'DataView', proto: true }, {
16
15
  setFloat16: function setFloat16(byteOffset, value /* , littleEndian */) {
17
- if (classof(this) !== 'DataView') throw new $TypeError('Incorrect receiver');
16
+ aDataView(this);
18
17
  var offset = toIndex(byteOffset);
19
18
  var bytes = packIEEE754(f16round(value), 10, 2);
20
19
  return setUint16(this, offset, bytes[1] << 8 | bytes[0], arguments.length > 2 ? arguments[2] : false);
@@ -1,11 +1,10 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
3
  var uncurryThis = require('../internals/function-uncurry-this');
4
- var classof = require('../internals/classof');
4
+ var aDataView = require('../internals/a-data-view');
5
5
  var toIndex = require('../internals/to-index');
6
6
  var toUint8Clamped = require('../internals/to-uint8-clamped');
7
7
 
8
- var $TypeError = TypeError;
9
8
  // eslint-disable-next-line es/no-typed-arrays -- safe
10
9
  var setUint8 = uncurryThis(DataView.prototype.setUint8);
11
10
 
@@ -13,7 +12,7 @@ var setUint8 = uncurryThis(DataView.prototype.setUint8);
13
12
  // https://github.com/tc39/proposal-dataview-get-set-uint8clamped
14
13
  $({ target: 'DataView', proto: true, forced: true }, {
15
14
  setUint8Clamped: function setUint8Clamped(byteOffset, value) {
16
- if (classof(this) !== 'DataView') throw new $TypeError('Incorrect receiver');
15
+ aDataView(this);
17
16
  var offset = toIndex(byteOffset);
18
17
  return setUint8(this, offset, toUint8Clamped(value));
19
18
  }
@@ -2,19 +2,24 @@
2
2
  var $ = require('../internals/export');
3
3
  var global = require('../internals/global');
4
4
  var anInstance = require('../internals/an-instance');
5
+ var anObject = require('../internals/an-object');
5
6
  var isCallable = require('../internals/is-callable');
6
7
  var getPrototypeOf = require('../internals/object-get-prototype-of');
7
- var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
8
+ var defineBuiltInAccessor = require('../internals/define-built-in-accessor');
9
+ var createProperty = require('../internals/create-property');
8
10
  var fails = require('../internals/fails');
9
11
  var hasOwn = require('../internals/has-own-property');
10
12
  var wellKnownSymbol = require('../internals/well-known-symbol');
11
13
  var IteratorPrototype = require('../internals/iterators-core').IteratorPrototype;
14
+ var DESCRIPTORS = require('../internals/descriptors');
12
15
  var IS_PURE = require('../internals/is-pure');
13
16
 
17
+ var CONSTRUCTOR = 'constructor';
18
+ var ITERATOR = 'Iterator';
14
19
  var TO_STRING_TAG = wellKnownSymbol('toStringTag');
15
20
 
16
21
  var $TypeError = TypeError;
17
- var NativeIterator = global.Iterator;
22
+ var NativeIterator = global[ITERATOR];
18
23
 
19
24
  // FF56- have non-standard global helper `Iterator`
20
25
  var FORCED = IS_PURE
@@ -28,12 +33,27 @@ var IteratorConstructor = function Iterator() {
28
33
  if (getPrototypeOf(this) === IteratorPrototype) throw new $TypeError('Abstract class Iterator not directly constructable');
29
34
  };
30
35
 
31
- if (!hasOwn(IteratorPrototype, TO_STRING_TAG)) {
32
- createNonEnumerableProperty(IteratorPrototype, TO_STRING_TAG, 'Iterator');
33
- }
36
+ var defineIteratorPrototypeAccessor = function (key, value) {
37
+ if (DESCRIPTORS) {
38
+ defineBuiltInAccessor(IteratorPrototype, key, {
39
+ configurable: true,
40
+ get: function () {
41
+ return value;
42
+ },
43
+ set: function (replacement) {
44
+ anObject(this);
45
+ if (this === IteratorPrototype) throw new $TypeError("You can't redefine this property");
46
+ if (hasOwn(this, key)) this[key] = replacement;
47
+ else createProperty(this, key, replacement);
48
+ }
49
+ });
50
+ } else IteratorPrototype[key] = value;
51
+ };
52
+
53
+ if (!hasOwn(IteratorPrototype, TO_STRING_TAG)) defineIteratorPrototypeAccessor(TO_STRING_TAG, ITERATOR);
34
54
 
35
- if (FORCED || !hasOwn(IteratorPrototype, 'constructor') || IteratorPrototype.constructor === Object) {
36
- createNonEnumerableProperty(IteratorPrototype, 'constructor', IteratorConstructor);
55
+ if (FORCED || !hasOwn(IteratorPrototype, CONSTRUCTOR) || IteratorPrototype[CONSTRUCTOR] === Object) {
56
+ defineIteratorPrototypeAccessor(CONSTRUCTOR, IteratorConstructor);
37
57
  }
38
58
 
39
59
  IteratorConstructor.prototype = IteratorPrototype;
@@ -1,9 +1,10 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
- var from = require('../internals/collection-from');
3
+ var MapHelpers = require('../internals/map-helpers');
4
+ var createCollectionFrom = require('../internals/collection-from');
4
5
 
5
6
  // `Map.from` method
6
7
  // https://tc39.github.io/proposal-setmap-offrom/#sec-map.from
7
8
  $({ target: 'Map', stat: true, forced: true }, {
8
- from: from
9
+ from: createCollectionFrom(MapHelpers.Map, MapHelpers.set, true)
9
10
  });
@@ -1,31 +1,3 @@
1
1
  'use strict';
2
- var $ = require('../internals/export');
3
- var uncurryThis = require('../internals/function-uncurry-this');
4
- var aCallable = require('../internals/a-callable');
5
- var requireObjectCoercible = require('../internals/require-object-coercible');
6
- var iterate = require('../internals/iterate');
7
- var MapHelpers = require('../internals/map-helpers');
8
- var IS_PURE = require('../internals/is-pure');
9
-
10
- var Map = MapHelpers.Map;
11
- var has = MapHelpers.has;
12
- var get = MapHelpers.get;
13
- var set = MapHelpers.set;
14
- var push = uncurryThis([].push);
15
-
16
- // `Map.groupBy` method
17
- // https://github.com/tc39/proposal-array-grouping
18
- $({ target: 'Map', stat: true, forced: IS_PURE }, {
19
- groupBy: function groupBy(items, callbackfn) {
20
- requireObjectCoercible(items);
21
- aCallable(callbackfn);
22
- var map = new Map();
23
- var k = 0;
24
- iterate(items, function (value) {
25
- var key = callbackfn(value, k++);
26
- if (!has(map, key)) set(map, key, [value]);
27
- else push(get(map, key), value);
28
- });
29
- return map;
30
- }
31
- });
2
+ // TODO: Remove from `core-js@4`
3
+ require('../modules/es.map.group-by');
@@ -1,9 +1,10 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
- var of = require('../internals/collection-of');
3
+ var MapHelpers = require('../internals/map-helpers');
4
+ var createCollectionOf = require('../internals/collection-of');
4
5
 
5
6
  // `Map.of` method
6
7
  // https://tc39.github.io/proposal-setmap-offrom/#sec-map.of
7
8
  $({ target: 'Map', stat: true, forced: true }, {
8
- of: of
9
+ of: createCollectionOf(MapHelpers.Map, MapHelpers.set, true)
9
10
  });
@@ -35,7 +35,7 @@ $({ target: 'Number', stat: true, forced: true }, {
35
35
  var parts = split(string, '.');
36
36
  var mathNum = $parseInt(parts[0], R);
37
37
  if (parts.length > 1) mathNum += $parseInt(parts[1], R) / pow(R, parts[1].length);
38
- if (numberToString(mathNum, R) !== string) throw new $SyntaxError(INVALID_NUMBER_REPRESENTATION);
38
+ if (R === 10 && numberToString(mathNum, R) !== string) throw new $SyntaxError(INVALID_NUMBER_REPRESENTATION);
39
39
  return sign * mathNum;
40
40
  }
41
41
  });
@@ -1,30 +1,3 @@
1
1
  'use strict';
2
- var $ = require('../internals/export');
3
- var getBuiltIn = require('../internals/get-built-in');
4
- var uncurryThis = require('../internals/function-uncurry-this');
5
- var aCallable = require('../internals/a-callable');
6
- var requireObjectCoercible = require('../internals/require-object-coercible');
7
- var toPropertyKey = require('../internals/to-property-key');
8
- var iterate = require('../internals/iterate');
9
-
10
- var create = getBuiltIn('Object', 'create');
11
- var push = uncurryThis([].push);
12
-
13
- // `Object.groupBy` method
14
- // https://github.com/tc39/proposal-array-grouping
15
- $({ target: 'Object', stat: true }, {
16
- groupBy: function groupBy(items, callbackfn) {
17
- requireObjectCoercible(items);
18
- aCallable(callbackfn);
19
- var obj = create(null);
20
- var k = 0;
21
- iterate(items, function (value) {
22
- var key = toPropertyKey(callbackfn(value, k++));
23
- // in some IE versions, `hasOwnProperty` returns incorrect result on integer keys
24
- // but since it's a `null` prototype object, we can safely use `in`
25
- if (key in obj) push(obj[key], value);
26
- else obj[key] = [value];
27
- });
28
- return obj;
29
- }
30
- });
2
+ // TODO: Remove from `core-js@4`
3
+ require('../modules/es.object.group-by');
@@ -1,16 +1,3 @@
1
1
  'use strict';
2
- var $ = require('../internals/export');
3
- var newPromiseCapabilityModule = require('../internals/new-promise-capability');
4
-
5
- // `Promise.withResolvers` method
6
- // https://github.com/tc39/proposal-promise-with-resolvers
7
- $({ target: 'Promise', stat: true }, {
8
- withResolvers: function withResolvers() {
9
- var promiseCapability = newPromiseCapabilityModule.f(this);
10
- return {
11
- promise: promiseCapability.promise,
12
- resolve: promiseCapability.resolve,
13
- reject: promiseCapability.reject
14
- };
15
- }
16
- });
2
+ // TODO: Remove from `core-js@4`
3
+ require('../modules/es.promise.with-resolvers');
@@ -1,9 +1,10 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
- var from = require('../internals/collection-from');
3
+ var SetHelpers = require('../internals/set-helpers');
4
+ var createCollectionFrom = require('../internals/collection-from');
4
5
 
5
6
  // `Set.from` method
6
7
  // https://tc39.github.io/proposal-setmap-offrom/#sec-set.from
7
8
  $({ target: 'Set', stat: true, forced: true }, {
8
- from: from
9
+ from: createCollectionFrom(SetHelpers.Set, SetHelpers.add, false)
9
10
  });
@@ -1,9 +1,10 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
- var of = require('../internals/collection-of');
3
+ var SetHelpers = require('../internals/set-helpers');
4
+ var createCollectionOf = require('../internals/collection-of');
4
5
 
5
6
  // `Set.of` method
6
7
  // https://tc39.github.io/proposal-setmap-offrom/#sec-set.of
7
8
  $({ target: 'Set', stat: true, forced: true }, {
8
- of: of
9
+ of: createCollectionOf(SetHelpers.Set, SetHelpers.add, false)
9
10
  });