core-js 3.22.5 → 3.22.7

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.
@@ -1,6 +1,6 @@
1
1
  var wellKnownSymbol = require('../internals/well-known-symbol');
2
2
  var create = require('../internals/object-create');
3
- var definePropertyModule = require('../internals/object-define-property');
3
+ var defineProperty = require('../internals/object-define-property').f;
4
4
 
5
5
  var UNSCOPABLES = wellKnownSymbol('unscopables');
6
6
  var ArrayPrototype = Array.prototype;
@@ -8,7 +8,7 @@ var ArrayPrototype = Array.prototype;
8
8
  // Array.prototype[@@unscopables]
9
9
  // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
10
10
  if (ArrayPrototype[UNSCOPABLES] == undefined) {
11
- definePropertyModule.f(ArrayPrototype, UNSCOPABLES, {
11
+ defineProperty(ArrayPrototype, UNSCOPABLES, {
12
12
  configurable: true,
13
13
  value: create(null)
14
14
  });
@@ -1,25 +1,20 @@
1
- var global = require('../internals/global');
2
1
  var isCallable = require('../internals/is-callable');
3
2
  var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
4
3
  var makeBuiltIn = require('../internals/make-built-in');
5
- var setGlobal = require('../internals/set-global');
4
+ var defineGlobalProperty = require('../internals/define-global-property');
6
5
 
7
6
  module.exports = function (O, key, value, options) {
8
- var unsafe = options ? !!options.unsafe : false;
9
- var simple = options ? !!options.enumerable : false;
10
- var noTargetGet = options ? !!options.noTargetGet : false;
11
- var name = options && options.name !== undefined ? options.name : key;
7
+ if (!options) options = {};
8
+ var simple = options.enumerable;
9
+ var name = options.name !== undefined ? options.name : key;
12
10
  if (isCallable(value)) makeBuiltIn(value, name, options);
13
- if (O === global) {
11
+ if (options.global) {
14
12
  if (simple) O[key] = value;
15
- else setGlobal(key, value);
16
- return O;
17
- } else if (!unsafe) {
18
- delete O[key];
19
- } else if (!noTargetGet && O[key]) {
20
- simple = true;
21
- }
22
- if (simple) O[key] = value;
23
- else createNonEnumerableProperty(O, key, value);
24
- return O;
13
+ else defineGlobalProperty(key, value);
14
+ } else {
15
+ if (!options.unsafe) delete O[key];
16
+ else if (O[key]) simple = true;
17
+ if (simple) O[key] = value;
18
+ else createNonEnumerableProperty(O, key, value);
19
+ } return O;
25
20
  };
@@ -2,24 +2,24 @@ var global = require('../internals/global');
2
2
  var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
3
3
  var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
4
4
  var defineBuiltIn = require('../internals/define-built-in');
5
- var setGlobal = require('../internals/set-global');
5
+ var defineGlobalProperty = require('../internals/define-global-property');
6
6
  var copyConstructorProperties = require('../internals/copy-constructor-properties');
7
7
  var isForced = require('../internals/is-forced');
8
8
 
9
9
  /*
10
- options.target - name of the target object
11
- options.global - target is the global object
12
- options.stat - export as static methods of target
13
- options.proto - export as prototype methods of target
14
- options.real - real prototype method for the `pure` version
15
- options.forced - export even if the native feature is available
16
- options.bind - bind methods to the target, required for the `pure` version
17
- options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
18
- options.unsafe - use the simple assignment of property instead of delete + defineProperty
19
- options.sham - add a flag to not completely full polyfills
20
- options.enumerable - export as enumerable property
21
- options.noTargetGet - prevent calling a getter on target
22
- options.name - the .name of the function if it does not match the key
10
+ options.target - name of the target object
11
+ options.global - target is the global object
12
+ options.stat - export as static methods of target
13
+ options.proto - export as prototype methods of target
14
+ options.real - real prototype method for the `pure` version
15
+ options.forced - export even if the native feature is available
16
+ options.bind - bind methods to the target, required for the `pure` version
17
+ options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
18
+ options.unsafe - use the simple assignment of property instead of delete + defineProperty
19
+ options.sham - add a flag to not completely full polyfills
20
+ options.enumerable - export as enumerable property
21
+ options.dontCallGetSet - prevent calling a getter on target
22
+ options.name - the .name of the function if it does not match the key
23
23
  */
24
24
  module.exports = function (options, source) {
25
25
  var TARGET = options.target;
@@ -29,13 +29,13 @@ module.exports = function (options, source) {
29
29
  if (GLOBAL) {
30
30
  target = global;
31
31
  } else if (STATIC) {
32
- target = global[TARGET] || setGlobal(TARGET, {});
32
+ target = global[TARGET] || defineGlobalProperty(TARGET, {});
33
33
  } else {
34
34
  target = (global[TARGET] || {}).prototype;
35
35
  }
36
36
  if (target) for (key in source) {
37
37
  sourceProperty = source[key];
38
- if (options.noTargetGet) {
38
+ if (options.dontCallGetSet) {
39
39
  descriptor = getOwnPropertyDescriptor(target, key);
40
40
  targetProperty = descriptor && descriptor.value;
41
41
  } else targetProperty = target[key];
@@ -29,11 +29,12 @@ var makeBuiltIn = module.exports = function (value, name, options) {
29
29
  if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) {
30
30
  defineProperty(value, 'length', { value: options.arity });
31
31
  }
32
- if (options && hasOwn(options, 'constructor') && options.constructor) {
33
- if (DESCRIPTORS) try {
34
- defineProperty(value, 'prototype', { writable: false });
35
- } catch (error) { /* empty */ }
36
- } else value.prototype = undefined;
32
+ try {
33
+ if (options && hasOwn(options, 'constructor') && options.constructor) {
34
+ if (DESCRIPTORS) defineProperty(value, 'prototype', { writable: false });
35
+ // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
36
+ } else if (value.prototype) value.prototype = undefined;
37
+ } catch (error) { /* empty */ }
37
38
  var state = enforceInternalState(value);
38
39
  if (!hasOwn(state, 'source')) {
39
40
  state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
@@ -10,5 +10,6 @@ module.exports = (!$expm1
10
10
  // Tor Browser bug
11
11
  || $expm1(-2e-17) != -2e-17
12
12
  ) ? function expm1(x) {
13
- return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : exp(x) - 1;
13
+ var n = +x;
14
+ return n == 0 ? n : n > -1e-6 && n < 1e-6 ? n + n * n / 2 : exp(n) - 1;
14
15
  } : $expm1;
@@ -15,8 +15,9 @@ var roundTiesToEven = function (n) {
15
15
  // https://tc39.es/ecma262/#sec-math.fround
16
16
  // eslint-disable-next-line es-x/no-math-fround -- safe
17
17
  module.exports = Math.fround || function fround(x) {
18
- var $abs = abs(x);
19
- var $sign = sign(x);
18
+ var n = +x;
19
+ var $abs = abs(n);
20
+ var $sign = sign(n);
20
21
  var a, result;
21
22
  if ($abs < MIN32) return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32;
22
23
  a = (1 + EPSILON32 / EPSILON) * $abs;
@@ -4,5 +4,6 @@ var log = Math.log;
4
4
  // https://tc39.es/ecma262/#sec-math.log1p
5
5
  // eslint-disable-next-line es-x/no-math-log1p -- safe
6
6
  module.exports = Math.log1p || function log1p(x) {
7
- return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : log(1 + x);
7
+ var n = +x;
8
+ return n > -1e-8 && n < 1e-8 ? n - n * n / 2 : log(1 + n);
8
9
  };
@@ -2,6 +2,7 @@
2
2
  // https://tc39.es/ecma262/#sec-math.sign
3
3
  // eslint-disable-next-line es-x/no-math-sign -- safe
4
4
  module.exports = Math.sign || function sign(x) {
5
+ var n = +x;
5
6
  // eslint-disable-next-line no-self-compare -- NaN check
6
- return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;
7
+ return n == 0 || n != n ? n : n < 0 ? -1 : 1;
7
8
  };
@@ -0,0 +1,10 @@
1
+ var ceil = Math.ceil;
2
+ var floor = Math.floor;
3
+
4
+ // `Math.trunc` method
5
+ // https://tc39.es/ecma262/#sec-math.trunc
6
+ // eslint-disable-next-line es-x/no-math-trunc -- safe
7
+ module.exports = Math.trunc || function trunc(x) {
8
+ var n = +x;
9
+ return (n > 0 ? floor : ceil)(n);
10
+ };
@@ -1,7 +1,7 @@
1
1
  var global = require('../internals/global');
2
- var setGlobal = require('../internals/set-global');
2
+ var defineGlobalProperty = require('../internals/define-global-property');
3
3
 
4
4
  var SHARED = '__core-js_shared__';
5
- var store = global[SHARED] || setGlobal(SHARED, {});
5
+ var store = global[SHARED] || defineGlobalProperty(SHARED, {});
6
6
 
7
7
  module.exports = store;
@@ -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.5',
7
+ version: '3.22.7',
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.5/LICENSE',
10
+ license: 'https://github.com/zloirock/core-js/blob/v3.22.7/LICENSE',
11
11
  source: 'https://github.com/zloirock/core-js'
12
12
  });
@@ -1,10 +1,9 @@
1
- var ceil = Math.ceil;
2
- var floor = Math.floor;
1
+ var trunc = require('../internals/math-trunc');
3
2
 
4
3
  // `ToIntegerOrInfinity` abstract operation
5
4
  // https://tc39.es/ecma262/#sec-tointegerorinfinity
6
5
  module.exports = function (argument) {
7
6
  var number = +argument;
8
- // eslint-disable-next-line no-self-compare -- safe
9
- return number !== number || number === 0 ? 0 : (number > 0 ? floor : ceil)(number);
7
+ // eslint-disable-next-line no-self-compare -- NaN check
8
+ return number !== number || number === 0 ? 0 : trunc(number);
10
9
  };
@@ -17,8 +17,9 @@ var FORCED = !$acosh
17
17
  // https://tc39.es/ecma262/#sec-math.acosh
18
18
  $({ target: 'Math', stat: true, forced: FORCED }, {
19
19
  acosh: function acosh(x) {
20
- return (x = +x) < 1 ? NaN : x > 94906265.62425156
21
- ? log(x) + LN2
22
- : log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1));
20
+ var n = +x;
21
+ return n < 1 ? NaN : n > 94906265.62425156
22
+ ? log(n) + LN2
23
+ : log1p(n - 1 + sqrt(n - 1) * sqrt(n + 1));
23
24
  }
24
25
  });
@@ -6,7 +6,8 @@ var log = Math.log;
6
6
  var sqrt = Math.sqrt;
7
7
 
8
8
  function asinh(x) {
9
- return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : log(x + sqrt(x * x + 1));
9
+ var n = +x;
10
+ return !isFinite(n) || n == 0 ? n : n < 0 ? -asinh(-n) : log(n + sqrt(n * n + 1));
10
11
  }
11
12
 
12
13
  // `Math.asinh` method
@@ -9,6 +9,7 @@ var log = Math.log;
9
9
  // Tor Browser bug: Math.atanh(-0) -> 0
10
10
  $({ target: 'Math', stat: true, forced: !($atanh && 1 / $atanh(-0) < 0) }, {
11
11
  atanh: function atanh(x) {
12
- return (x = +x) == 0 ? x : log((1 + x) / (1 - x)) / 2;
12
+ var n = +x;
13
+ return n == 0 ? n : log((1 + n) / (1 - n)) / 2;
13
14
  }
14
15
  });
@@ -8,6 +8,7 @@ var pow = Math.pow;
8
8
  // https://tc39.es/ecma262/#sec-math.cbrt
9
9
  $({ target: 'Math', stat: true }, {
10
10
  cbrt: function cbrt(x) {
11
- return sign(x = +x) * pow(abs(x), 1 / 3);
11
+ var n = +x;
12
+ return sign(n) * pow(abs(n), 1 / 3);
12
13
  }
13
14
  });
@@ -8,6 +8,7 @@ var LOG2E = Math.LOG2E;
8
8
  // https://tc39.es/ecma262/#sec-math.clz32
9
9
  $({ target: 'Math', stat: true }, {
10
10
  clz32: function clz32(x) {
11
- return (x >>>= 0) ? 31 - floor(log(x + 0.5) * LOG2E) : 32;
11
+ var n = x >>> 0;
12
+ return n ? 31 - floor(log(n + 0.5) * LOG2E) : 32;
12
13
  }
13
14
  });
@@ -16,6 +16,7 @@ var FORCED = fails(function () {
16
16
  // V8 near Chromium 38 has a problem with very small numbers
17
17
  $({ target: 'Math', stat: true, forced: FORCED }, {
18
18
  sinh: function sinh(x) {
19
- return abs(x = +x) < 1 ? (expm1(x) - expm1(-x)) / 2 : (exp(x - 1) - exp(-x - 1)) * (E / 2);
19
+ var n = +x;
20
+ return abs(n) < 1 ? (expm1(n) - expm1(-n)) / 2 : (exp(n - 1) - exp(-n - 1)) * (E / 2);
20
21
  }
21
22
  });
@@ -7,8 +7,9 @@ var exp = Math.exp;
7
7
  // https://tc39.es/ecma262/#sec-math.tanh
8
8
  $({ target: 'Math', stat: true }, {
9
9
  tanh: function tanh(x) {
10
- var a = expm1(x = +x);
11
- var b = expm1(-x);
12
- return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x));
10
+ var n = +x;
11
+ var a = expm1(n);
12
+ var b = expm1(-n);
13
+ return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(n) + exp(-n));
13
14
  }
14
15
  });
@@ -1,12 +1,8 @@
1
1
  var $ = require('../internals/export');
2
-
3
- var ceil = Math.ceil;
4
- var floor = Math.floor;
2
+ var trunc = require('../internals/math-trunc');
5
3
 
6
4
  // `Math.trunc` method
7
5
  // https://tc39.es/ecma262/#sec-math.trunc
8
6
  $({ target: 'Math', stat: true }, {
9
- trunc: function trunc(it) {
10
- return (it > 0 ? floor : ceil)(it);
11
- }
7
+ trunc: trunc
12
8
  });
@@ -4,6 +4,8 @@ var $ = require('../internals/export');
4
4
  // https://github.com/tc39/proposal-Math.signbit
5
5
  $({ target: 'Math', stat: true, forced: true }, {
6
6
  signbit: function signbit(x) {
7
- return (x = +x) == x && x == 0 ? 1 / x == -Infinity : x < 0;
7
+ var n = +x;
8
+ // eslint-disable-next-line no-self-compare -- NaN check
9
+ return n == n && n == 0 ? 1 / n == -Infinity : n < 0;
8
10
  }
9
11
  });
@@ -9,7 +9,7 @@ var process = global.process;
9
9
 
10
10
  // `queueMicrotask` method
11
11
  // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-queuemicrotask
12
- $({ global: true, enumerable: true, noTargetGet: true }, {
12
+ $({ global: true, enumerable: true, dontCallGetSet: true }, {
13
13
  queueMicrotask: function queueMicrotask(fn) {
14
14
  validateArgumentsLength(arguments.length, 1);
15
15
  aCallable(fn);
@@ -364,7 +364,7 @@ if (!USE_NATIVE_URL && isCallable(Headers)) {
364
364
  };
365
365
 
366
366
  if (isCallable(nativeFetch)) {
367
- $({ global: true, enumerable: true, noTargetGet: true, forced: true }, {
367
+ $({ global: true, enumerable: true, dontCallGetSet: true, forced: true }, {
368
368
  fetch: function fetch(input /* , init */) {
369
369
  return nativeFetch(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {});
370
370
  }
@@ -380,7 +380,7 @@ if (!USE_NATIVE_URL && isCallable(Headers)) {
380
380
  RequestPrototype.constructor = RequestConstructor;
381
381
  RequestConstructor.prototype = RequestPrototype;
382
382
 
383
- $({ global: true, constructor: true, noTargetGet: true, forced: true }, {
383
+ $({ global: true, constructor: true, dontCallGetSet: true, forced: true }, {
384
384
  Request: RequestConstructor
385
385
  });
386
386
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "core-js",
3
3
  "description": "Standard library",
4
- "version": "3.22.5",
4
+ "version": "3.22.7",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/zloirock/core-js.git"