core-js 3.23.2 → 3.23.3

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.
@@ -12,8 +12,10 @@ module.exports = function (O, key, value, options) {
12
12
  if (simple) O[key] = value;
13
13
  else defineGlobalProperty(key, value);
14
14
  } else {
15
- if (!options.unsafe) delete O[key];
16
- else if (O[key]) simple = true;
15
+ try {
16
+ if (!options.unsafe) delete O[key];
17
+ else if (O[key]) simple = true;
18
+ } catch (error) { /* empty */ }
17
19
  if (simple) O[key] = value;
18
20
  else definePropertyModule.f(O, key, {
19
21
  value: value,
@@ -0,0 +1,8 @@
1
+ var classof = require('../internals/classof');
2
+ var uncurryThis = require('../internals/function-uncurry-this');
3
+
4
+ var slice = uncurryThis(''.slice);
5
+
6
+ module.exports = function (it) {
7
+ return slice(classof(it), 0, 3) === 'Big';
8
+ };
@@ -24,7 +24,8 @@ var makeBuiltIn = module.exports = function (value, name, options) {
24
24
  if (options && options.getter) name = 'get ' + name;
25
25
  if (options && options.setter) name = 'set ' + name;
26
26
  if (!hasOwn(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
27
- defineProperty(value, 'name', { value: name, configurable: true });
27
+ if (DESCRIPTORS) defineProperty(value, 'name', { value: name, configurable: true });
28
+ else value.name = name;
28
29
  }
29
30
  if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) {
30
31
  defineProperty(value, 'length', { value: options.arity });
@@ -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.2',
7
+ version: '3.23.3',
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.2/LICENSE',
10
+ license: 'https://github.com/zloirock/core-js/blob/v3.23.3/LICENSE',
11
11
  source: 'https://github.com/zloirock/core-js'
12
12
  });
@@ -1,18 +1,43 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
- var toIndexedObject = require('../internals/to-indexed-object');
4
- var arraySlice = require('../internals/array-slice');
5
- var arrayToSpliced = require('../internals/array-to-spliced');
6
3
  var addToUnscopables = require('../internals/add-to-unscopables');
4
+ var doesNotExceedSafeInteger = require('../internals/does-not-exceed-safe-integer');
5
+ var lengthOfArrayLike = require('../internals/length-of-array-like');
6
+ var toAbsoluteIndex = require('../internals/to-absolute-index');
7
+ var toIndexedObject = require('../internals/to-indexed-object');
8
+ var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
7
9
 
8
10
  var $Array = Array;
11
+ var max = Math.max;
12
+ var min = Math.min;
9
13
 
10
14
  // `Array.prototype.toSpliced` method
11
15
  // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toSpliced
12
- $({ target: 'Array', proto: true, arity: 2 }, {
13
- // eslint-disable-next-line no-unused-vars -- required for .length
16
+ $({ target: 'Array', proto: true }, {
14
17
  toSpliced: function toSpliced(start, deleteCount /* , ...items */) {
15
- return arrayToSpliced(toIndexedObject(this), $Array, arraySlice(arguments));
18
+ var O = toIndexedObject(this);
19
+ var len = lengthOfArrayLike(O);
20
+ var actualStart = toAbsoluteIndex(start, len);
21
+ var argumentsLength = arguments.length;
22
+ var k = 0;
23
+ var insertCount, actualDeleteCount, newLen, A;
24
+ if (argumentsLength === 0) {
25
+ insertCount = actualDeleteCount = 0;
26
+ } else if (argumentsLength === 1) {
27
+ insertCount = 0;
28
+ actualDeleteCount = len - actualStart;
29
+ } else {
30
+ insertCount = argumentsLength - 2;
31
+ actualDeleteCount = min(max(toIntegerOrInfinity(deleteCount), 0), len - actualStart);
32
+ }
33
+ newLen = doesNotExceedSafeInteger(len + insertCount - actualDeleteCount);
34
+ A = $Array(newLen);
35
+
36
+ for (; k < actualStart; k++) A[k] = O[k];
37
+ for (; k < actualStart + insertCount; k++) A[k] = arguments[k - actualStart + 2];
38
+ for (; k < newLen; k++) A[k] = O[k + actualDeleteCount - insertCount];
39
+
40
+ return A;
16
41
  }
17
42
  });
18
43
 
@@ -1,15 +1,62 @@
1
1
  'use strict';
2
2
  var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
3
- var arraySlice = require('../internals/array-slice');
4
- var arrayToSpliced = require('../internals/array-to-spliced');
3
+ var lengthOfArrayLike = require('../internals/length-of-array-like');
4
+ var toAbsoluteIndex = require('../internals/to-absolute-index');
5
+ var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
6
+ var fails = require('../internals/fails');
5
7
 
6
8
  var aTypedArray = ArrayBufferViewCore.aTypedArray;
7
9
  var getTypedArrayConstructor = ArrayBufferViewCore.getTypedArrayConstructor;
8
10
  var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
11
+ var max = Math.max;
12
+ var min = Math.min;
13
+
14
+ // some early implementations, like WebKit, does not follow the final semantic
15
+ var PROPER_ORDER = !fails(function () {
16
+ // eslint-disable-next-line es-x/no-typed-arrays -- required for testing
17
+ var array = new Int8Array([1]);
18
+
19
+ var spliced = array.toSpliced(1, 0, {
20
+ valueOf: function () {
21
+ array[0] = 2;
22
+ return 3;
23
+ }
24
+ });
25
+
26
+ return spliced[0] !== 2 || spliced[1] !== 3;
27
+ });
9
28
 
10
29
  // `%TypedArray%.prototype.toSpliced` method
11
30
  // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toSpliced
12
- // eslint-disable-next-line no-unused-vars -- required for .length
13
31
  exportTypedArrayMethod('toSpliced', function toSpliced(start, deleteCount /* , ...items */) {
14
- return arrayToSpliced(aTypedArray(this), getTypedArrayConstructor(this), arraySlice(arguments));
15
- }, { arity: 2 });
32
+ var O = aTypedArray(this);
33
+ var C = getTypedArrayConstructor(O);
34
+ var len = lengthOfArrayLike(O);
35
+ var actualStart = toAbsoluteIndex(start, len);
36
+ var argumentsLength = arguments.length;
37
+ var k = 0;
38
+ var insertCount, actualDeleteCount, convertedItems, newLen, A;
39
+ if (argumentsLength === 0) {
40
+ insertCount = actualDeleteCount = 0;
41
+ } else if (argumentsLength === 1) {
42
+ insertCount = 0;
43
+ actualDeleteCount = len - actualStart;
44
+ } else {
45
+ actualDeleteCount = min(max(toIntegerOrInfinity(deleteCount), 0), len - actualStart);
46
+ insertCount = argumentsLength - 2;
47
+ if (insertCount) {
48
+ convertedItems = new C(insertCount);
49
+ for (var i = 2; i < argumentsLength; i++) {
50
+ convertedItems[i - 2] = arguments[i];
51
+ }
52
+ }
53
+ }
54
+ newLen = len + insertCount - actualDeleteCount;
55
+ A = new C(newLen);
56
+
57
+ for (; k < actualStart; k++) A[k] = O[k];
58
+ for (; k < actualStart + insertCount; k++) A[k] = convertedItems[k - actualStart];
59
+ for (; k < newLen; k++) A[k] = O[k + actualDeleteCount - insertCount];
60
+
61
+ return A;
62
+ }, !PROPER_ORDER);
@@ -1,15 +1,13 @@
1
1
  'use strict';
2
2
  var arrayWith = require('../internals/array-with');
3
3
  var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
4
+ var isBigIntArray = require('../internals/is-big-int-array');
4
5
  var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
5
6
  var toBigInt = require('../internals/to-big-int');
6
- var classof = require('../internals/classof');
7
- var uncurryThis = require('../internals/function-uncurry-this');
8
7
 
9
8
  var aTypedArray = ArrayBufferViewCore.aTypedArray;
10
9
  var getTypedArrayConstructor = ArrayBufferViewCore.getTypedArrayConstructor;
11
10
  var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
12
- var slice = uncurryThis(''.slice);
13
11
 
14
12
  var PROPER_ORDER = !!function () {
15
13
  try {
@@ -25,8 +23,8 @@ var PROPER_ORDER = !!function () {
25
23
  // `%TypedArray%.prototype.with` method
26
24
  // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.with
27
25
  exportTypedArrayMethod('with', { 'with': function (index, value) {
28
- aTypedArray(this);
26
+ var O = aTypedArray(this);
29
27
  var relativeIndex = toIntegerOrInfinity(index);
30
- var actualValue = slice(classof(this), 0, 3) === 'Big' ? toBigInt(value) : +value;
31
- return arrayWith(this, getTypedArrayConstructor(this), relativeIndex, actualValue);
28
+ var actualValue = isBigIntArray(O) ? toBigInt(value) : +value;
29
+ return arrayWith(O, getTypedArrayConstructor(O), relativeIndex, actualValue);
32
30
  } }['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.2",
4
+ "version": "3.23.3",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/zloirock/core-js.git"
@@ -1,36 +0,0 @@
1
- var lengthOfArrayLike = require('../internals/length-of-array-like');
2
- var doesNotExceedSafeInteger = require('../internals/does-not-exceed-safe-integer');
3
- var toAbsoluteIndex = require('../internals/to-absolute-index');
4
- var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
5
-
6
- var max = Math.max;
7
- var min = Math.min;
8
-
9
- // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toSpliced
10
- // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toSpliced
11
- module.exports = function (O, C, args) {
12
- var start = args[0];
13
- var deleteCount = args[1];
14
- var len = lengthOfArrayLike(O);
15
- var actualStart = toAbsoluteIndex(start, len);
16
- var argumentsLength = args.length;
17
- var k = 0;
18
- var insertCount, actualDeleteCount, newLen, A;
19
- if (argumentsLength === 0) {
20
- insertCount = actualDeleteCount = 0;
21
- } else if (argumentsLength === 1) {
22
- insertCount = 0;
23
- actualDeleteCount = len - actualStart;
24
- } else {
25
- insertCount = argumentsLength - 2;
26
- actualDeleteCount = min(max(toIntegerOrInfinity(deleteCount), 0), len - actualStart);
27
- }
28
- newLen = doesNotExceedSafeInteger(len + insertCount - actualDeleteCount);
29
- A = new C(newLen);
30
-
31
- for (; k < actualStart; k++) A[k] = O[k];
32
- for (; k < actualStart + insertCount; k++) A[k] = args[k - actualStart + 2];
33
- for (; k < newLen; k++) A[k] = O[k + actualDeleteCount - insertCount];
34
-
35
- return A;
36
- };