core-js 3.23.1 → 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.
@@ -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,
@@ -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.23.1',
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.23.1/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
  };
@@ -1,9 +1,7 @@
1
1
  var $ = require('../internals/export');
2
2
 
3
- var DEG_PER_RAD = Math.PI / 180;
4
-
5
3
  // `Math.DEG_PER_RAD` constant
6
4
  // https://rwaldron.github.io/proposal-math-extensions/
7
- $({ target: 'Math', stat: true, nonConfigurable: true, nonWritable: true, forced: Math.DEG_PER_RAD !== DEG_PER_RAD }, {
8
- DEG_PER_RAD: DEG_PER_RAD
5
+ $({ target: 'Math', stat: true, nonConfigurable: true, nonWritable: true }, {
6
+ DEG_PER_RAD: Math.PI / 180
9
7
  });
@@ -1,9 +1,7 @@
1
1
  var $ = require('../internals/export');
2
2
 
3
- var RAD_PER_DEG = 180 / Math.PI;
4
-
5
3
  // `Math.RAD_PER_DEG` constant
6
4
  // https://rwaldron.github.io/proposal-math-extensions/
7
- $({ target: 'Math', stat: true, nonConfigurable: true, nonWritable: true, forced: Math.RAD_PER_DEG !== RAD_PER_DEG }, {
8
- RAD_PER_DEG: RAD_PER_DEG
5
+ $({ target: 'Math', stat: true, nonConfigurable: true, nonWritable: true }, {
6
+ RAD_PER_DEG: 180 / Math.PI
9
7
  });
@@ -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
  });
@@ -5,8 +5,8 @@ var aCallable = require('../internals/a-callable');
5
5
  var arrayFromConstructorAndList = require('../internals/array-from-constructor-and-list');
6
6
 
7
7
  var aTypedArray = ArrayBufferViewCore.aTypedArray;
8
+ var getTypedArrayConstructor = ArrayBufferViewCore.getTypedArrayConstructor;
8
9
  var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
9
- var TYPED_ARRAY_CONSTRUCTOR = ArrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR;
10
10
  var sort = uncurryThis(ArrayBufferViewCore.TypedArrayPrototype.sort);
11
11
 
12
12
  // `%TypedArray%.prototype.toSorted` method
@@ -14,6 +14,6 @@ var sort = uncurryThis(ArrayBufferViewCore.TypedArrayPrototype.sort);
14
14
  exportTypedArrayMethod('toSorted', function toSorted(compareFn) {
15
15
  if (compareFn !== undefined) aCallable(compareFn);
16
16
  var O = aTypedArray(this);
17
- var A = arrayFromConstructorAndList(O[TYPED_ARRAY_CONSTRUCTOR], O);
17
+ var A = arrayFromConstructorAndList(getTypedArrayConstructor(O), O);
18
18
  return sort(A, compareFn);
19
19
  });
@@ -4,12 +4,12 @@ var arraySlice = require('../internals/array-slice');
4
4
  var arrayToSpliced = require('../internals/array-to-spliced');
5
5
 
6
6
  var aTypedArray = ArrayBufferViewCore.aTypedArray;
7
+ var getTypedArrayConstructor = ArrayBufferViewCore.getTypedArrayConstructor;
7
8
  var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
8
- var TYPED_ARRAY_CONSTRUCTOR = ArrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR;
9
9
 
10
10
  // `%TypedArray%.prototype.toSpliced` method
11
11
  // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toSpliced
12
12
  // eslint-disable-next-line no-unused-vars -- required for .length
13
13
  exportTypedArrayMethod('toSpliced', function toSpliced(start, deleteCount /* , ...items */) {
14
- return arrayToSpliced(aTypedArray(this), this[TYPED_ARRAY_CONSTRUCTOR], arraySlice(arguments));
14
+ return arrayToSpliced(aTypedArray(this), getTypedArrayConstructor(this), arraySlice(arguments));
15
15
  }, { arity: 2 });
@@ -7,8 +7,8 @@ var classof = require('../internals/classof');
7
7
  var uncurryThis = require('../internals/function-uncurry-this');
8
8
 
9
9
  var aTypedArray = ArrayBufferViewCore.aTypedArray;
10
+ var getTypedArrayConstructor = ArrayBufferViewCore.getTypedArrayConstructor;
10
11
  var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
11
- var TYPED_ARRAY_CONSTRUCTOR = ArrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR;
12
12
  var slice = uncurryThis(''.slice);
13
13
 
14
14
  var PROPER_ORDER = !!function () {
@@ -28,5 +28,5 @@ exportTypedArrayMethod('with', { 'with': function (index, value) {
28
28
  aTypedArray(this);
29
29
  var relativeIndex = toIntegerOrInfinity(index);
30
30
  var actualValue = slice(classof(this), 0, 3) === 'Big' ? toBigInt(value) : +value;
31
- return arrayWith(this, this[TYPED_ARRAY_CONSTRUCTOR], relativeIndex, actualValue);
31
+ return arrayWith(this, getTypedArrayConstructor(this), relativeIndex, actualValue);
32
32
  } }['with'], !PROPER_ORDER);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "core-js",
3
3
  "description": "Standard library",
4
- "version": "3.23.1",
4
+ "version": "3.23.2",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/zloirock/core-js.git"