core-js 3.27.0 → 3.27.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 (60) hide show
  1. package/LICENSE +1 -1
  2. package/actual/async-iterator/from.js +11 -0
  3. package/actual/disposable-stack/constructor.js +2 -0
  4. package/actual/disposable-stack/index.js +2 -0
  5. package/actual/iterator/from.js +14 -0
  6. package/actual/suppressed-error.js +1 -0
  7. package/full/async-disposable-stack/constructor.js +3 -0
  8. package/full/async-disposable-stack/index.js +3 -0
  9. package/internals/async-iterator-create-proxy.js +8 -17
  10. package/internals/collection-weak.js +2 -2
  11. package/internals/engine-is-ios-pebble.js +1 -2
  12. package/internals/engine-is-node.js +1 -2
  13. package/internals/engine-user-agent.js +1 -3
  14. package/internals/error-stack-install.js +13 -0
  15. package/internals/get-set-record.js +2 -1
  16. package/internals/host-report-errors.js +3 -5
  17. package/internals/is-big-int-array.js +2 -4
  18. package/internals/iterator-create-proxy.js +9 -18
  19. package/internals/make-built-in.js +8 -3
  20. package/internals/microtask.js +20 -25
  21. package/internals/queue.js +4 -3
  22. package/internals/set-is-disjoint-from.js +8 -8
  23. package/internals/set-is-superset-of.js +4 -2
  24. package/internals/shared.js +3 -3
  25. package/internals/string-cooked.js +3 -0
  26. package/internals/string-punycode-to-ascii.js +0 -1
  27. package/internals/task.js +8 -8
  28. package/internals/well-known-symbol.js +6 -12
  29. package/internals/wrap-error-constructor-with-cause.js +2 -3
  30. package/modules/es.aggregate-error.constructor.js +3 -5
  31. package/modules/es.array.concat.js +1 -3
  32. package/modules/es.array.index-of.js +2 -2
  33. package/modules/es.array.join.js +2 -2
  34. package/modules/es.array.push.js +5 -3
  35. package/modules/es.array.reduce-right.js +2 -2
  36. package/modules/es.array.reduce.js +2 -2
  37. package/modules/es.array.unshift.js +5 -3
  38. package/modules/es.date.get-year.js +1 -0
  39. package/modules/es.error.cause.js +1 -0
  40. package/modules/es.math.asinh.js +3 -1
  41. package/modules/es.math.atanh.js +3 -1
  42. package/modules/es.math.cosh.js +3 -1
  43. package/modules/es.math.hypot.js +2 -2
  44. package/modules/es.number.to-exponential.js +14 -11
  45. package/modules/es.object.get-own-property-descriptor.js +1 -2
  46. package/modules/es.object.is-frozen.js +3 -2
  47. package/modules/es.object.is-sealed.js +3 -2
  48. package/modules/es.promise.all-settled.js +2 -1
  49. package/modules/es.promise.any.js +2 -1
  50. package/modules/es.regexp.sticky.js +1 -1
  51. package/modules/es.string.raw.js +2 -1
  52. package/modules/es.string.substr.js +1 -1
  53. package/modules/es.weak-map.constructor.js +45 -4
  54. package/modules/esnext.suppressed-error.constructor.js +3 -5
  55. package/modules/web.atob.js +5 -2
  56. package/modules/web.btoa.js +5 -2
  57. package/modules/web.dom-exception.constructor.js +4 -0
  58. package/modules/web.dom-exception.to-string-tag.js +1 -0
  59. package/package.json +1 -1
  60. package/postinstall.js +1 -1
@@ -7,19 +7,17 @@ var copyConstructorProperties = require('../internals/copy-constructor-propertie
7
7
  var create = require('../internals/object-create');
8
8
  var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
9
9
  var createPropertyDescriptor = require('../internals/create-property-descriptor');
10
- var clearErrorStack = require('../internals/error-stack-clear');
11
10
  var installErrorCause = require('../internals/install-error-cause');
11
+ var installErrorStack = require('../internals/error-stack-install');
12
12
  var iterate = require('../internals/iterate');
13
13
  var normalizeStringArgument = require('../internals/normalize-string-argument');
14
14
  var wellKnownSymbol = require('../internals/well-known-symbol');
15
- var ERROR_STACK_INSTALLABLE = require('../internals/error-stack-installable');
16
15
 
17
16
  var TO_STRING_TAG = wellKnownSymbol('toStringTag');
18
17
  var $Error = Error;
19
18
  var push = [].push;
20
19
 
21
20
  var $AggregateError = function AggregateError(errors, message /* , options */) {
22
- var options = arguments.length > 2 ? arguments[2] : undefined;
23
21
  var isInstance = isPrototypeOf(AggregateErrorPrototype, this);
24
22
  var that;
25
23
  if (setPrototypeOf) {
@@ -29,8 +27,8 @@ var $AggregateError = function AggregateError(errors, message /* , options */) {
29
27
  createNonEnumerableProperty(that, TO_STRING_TAG, 'Error');
30
28
  }
31
29
  if (message !== undefined) createNonEnumerableProperty(that, 'message', normalizeStringArgument(message));
32
- if (ERROR_STACK_INSTALLABLE) createNonEnumerableProperty(that, 'stack', clearErrorStack(that.stack, 1));
33
- installErrorCause(that, options);
30
+ installErrorStack(that, $AggregateError, that.stack, 1);
31
+ if (arguments.length > 2) installErrorCause(that, arguments[2]);
34
32
  var errorsArray = [];
35
33
  iterate(errors, push, { that: errorsArray });
36
34
  createNonEnumerableProperty(that, 'errors', errorsArray);
@@ -23,15 +23,13 @@ var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () {
23
23
  return array.concat()[0] !== array;
24
24
  });
25
25
 
26
- var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
27
-
28
26
  var isConcatSpreadable = function (O) {
29
27
  if (!isObject(O)) return false;
30
28
  var spreadable = O[IS_CONCAT_SPREADABLE];
31
29
  return spreadable !== undefined ? !!spreadable : isArray(O);
32
30
  };
33
31
 
34
- var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
32
+ var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !arrayMethodHasSpeciesSupport('concat');
35
33
 
36
34
  // `Array.prototype.concat` method
37
35
  // https://tc39.es/ecma262/#sec-array.prototype.concat
@@ -8,11 +8,11 @@ var arrayMethodIsStrict = require('../internals/array-method-is-strict');
8
8
  var nativeIndexOf = uncurryThis([].indexOf);
9
9
 
10
10
  var NEGATIVE_ZERO = !!nativeIndexOf && 1 / nativeIndexOf([1], 1, -0) < 0;
11
- var STRICT_METHOD = arrayMethodIsStrict('indexOf');
11
+ var FORCED = NEGATIVE_ZERO || !arrayMethodIsStrict('indexOf');
12
12
 
13
13
  // `Array.prototype.indexOf` method
14
14
  // https://tc39.es/ecma262/#sec-array.prototype.indexof
15
- $({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD }, {
15
+ $({ target: 'Array', proto: true, forced: FORCED }, {
16
16
  indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
17
17
  var fromIndex = arguments.length > 1 ? arguments[1] : undefined;
18
18
  return NEGATIVE_ZERO
@@ -8,11 +8,11 @@ var arrayMethodIsStrict = require('../internals/array-method-is-strict');
8
8
  var nativeJoin = uncurryThis([].join);
9
9
 
10
10
  var ES3_STRINGS = IndexedObject != Object;
11
- var STRICT_METHOD = arrayMethodIsStrict('join', ',');
11
+ var FORCED = ES3_STRINGS || !arrayMethodIsStrict('join', ',');
12
12
 
13
13
  // `Array.prototype.join` method
14
14
  // https://tc39.es/ecma262/#sec-array.prototype.join
15
- $({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD }, {
15
+ $({ target: 'Array', proto: true, forced: FORCED }, {
16
16
  join: function join(separator) {
17
17
  return nativeJoin(toIndexedObject(this), separator === undefined ? ',' : separator);
18
18
  }
@@ -12,18 +12,20 @@ var INCORRECT_TO_LENGTH = fails(function () {
12
12
 
13
13
  // V8 and Safari <= 15.4, FF < 23 throws InternalError
14
14
  // https://bugs.chromium.org/p/v8/issues/detail?id=12681
15
- var SILENT_ON_NON_WRITABLE_LENGTH = !function () {
15
+ var properErrorOnNonWritableLength = function () {
16
16
  try {
17
17
  // eslint-disable-next-line es/no-object-defineproperty -- safe
18
18
  Object.defineProperty([], 'length', { writable: false }).push();
19
19
  } catch (error) {
20
20
  return error instanceof TypeError;
21
21
  }
22
- }();
22
+ };
23
+
24
+ var FORCED = INCORRECT_TO_LENGTH || !properErrorOnNonWritableLength();
23
25
 
24
26
  // `Array.prototype.push` method
25
27
  // https://tc39.es/ecma262/#sec-array.prototype.push
26
- $({ target: 'Array', proto: true, arity: 1, forced: INCORRECT_TO_LENGTH || SILENT_ON_NON_WRITABLE_LENGTH }, {
28
+ $({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
27
29
  // eslint-disable-next-line no-unused-vars -- required for `.length`
28
30
  push: function push(item) {
29
31
  var O = toObject(this);
@@ -5,14 +5,14 @@ var arrayMethodIsStrict = require('../internals/array-method-is-strict');
5
5
  var CHROME_VERSION = require('../internals/engine-v8-version');
6
6
  var IS_NODE = require('../internals/engine-is-node');
7
7
 
8
- var STRICT_METHOD = arrayMethodIsStrict('reduceRight');
9
8
  // Chrome 80-82 has a critical bug
10
9
  // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
11
10
  var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;
11
+ var FORCED = CHROME_BUG || !arrayMethodIsStrict('reduceRight');
12
12
 
13
13
  // `Array.prototype.reduceRight` method
14
14
  // https://tc39.es/ecma262/#sec-array.prototype.reduceright
15
- $({ target: 'Array', proto: true, forced: !STRICT_METHOD || CHROME_BUG }, {
15
+ $({ target: 'Array', proto: true, forced: FORCED }, {
16
16
  reduceRight: function reduceRight(callbackfn /* , initialValue */) {
17
17
  return $reduceRight(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
18
18
  }
@@ -5,14 +5,14 @@ var arrayMethodIsStrict = require('../internals/array-method-is-strict');
5
5
  var CHROME_VERSION = require('../internals/engine-v8-version');
6
6
  var IS_NODE = require('../internals/engine-is-node');
7
7
 
8
- var STRICT_METHOD = arrayMethodIsStrict('reduce');
9
8
  // Chrome 80-82 has a critical bug
10
9
  // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
11
10
  var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;
11
+ var FORCED = CHROME_BUG || !arrayMethodIsStrict('reduce');
12
12
 
13
13
  // `Array.prototype.reduce` method
14
14
  // https://tc39.es/ecma262/#sec-array.prototype.reduce
15
- $({ target: 'Array', proto: true, forced: !STRICT_METHOD || CHROME_BUG }, {
15
+ $({ target: 'Array', proto: true, forced: FORCED }, {
16
16
  reduce: function reduce(callbackfn /* , initialValue */) {
17
17
  var length = arguments.length;
18
18
  return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
@@ -10,18 +10,20 @@ var doesNotExceedSafeInteger = require('../internals/does-not-exceed-safe-intege
10
10
  var INCORRECT_RESULT = [].unshift(0) !== 1;
11
11
 
12
12
  // V8 ~ Chrome < 71 and Safari <= 15.4, FF < 23 throws InternalError
13
- var SILENT_ON_NON_WRITABLE_LENGTH = !function () {
13
+ var properErrorOnNonWritableLength = function () {
14
14
  try {
15
15
  // eslint-disable-next-line es/no-object-defineproperty -- safe
16
16
  Object.defineProperty([], 'length', { writable: false }).unshift();
17
17
  } catch (error) {
18
18
  return error instanceof TypeError;
19
19
  }
20
- }();
20
+ };
21
+
22
+ var FORCED = INCORRECT_RESULT || !properErrorOnNonWritableLength();
21
23
 
22
24
  // `Array.prototype.unshift` method
23
25
  // https://tc39.es/ecma262/#sec-array.prototype.unshift
24
- $({ target: 'Array', proto: true, arity: 1, forced: INCORRECT_RESULT || SILENT_ON_NON_WRITABLE_LENGTH }, {
26
+ $({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
25
27
  // eslint-disable-next-line no-unused-vars -- required for `.length`
26
28
  unshift: function unshift(item) {
27
29
  var O = toObject(this);
@@ -3,6 +3,7 @@ var $ = require('../internals/export');
3
3
  var uncurryThis = require('../internals/function-uncurry-this');
4
4
  var fails = require('../internals/fails');
5
5
 
6
+ // IE8- non-standard case
6
7
  var FORCED = fails(function () {
7
8
  return new Date(16e11).getYear() !== 120;
8
9
  });
@@ -23,6 +23,7 @@ var exportWebAssemblyErrorCauseWrapper = function (ERROR_NAME, wrapper) {
23
23
  }
24
24
  };
25
25
 
26
+ // https://tc39.es/ecma262/#sec-nativeerror
26
27
  // https://github.com/tc39/proposal-error-cause
27
28
  exportGlobalErrorCauseWrapper('Error', function (init) {
28
29
  return function Error(message) { return apply(init, this, arguments); };
@@ -10,9 +10,11 @@ function asinh(x) {
10
10
  return !isFinite(n) || n == 0 ? n : n < 0 ? -asinh(-n) : log(n + sqrt(n * n + 1));
11
11
  }
12
12
 
13
+ var FORCED = !($asinh && 1 / $asinh(0) > 0);
14
+
13
15
  // `Math.asinh` method
14
16
  // https://tc39.es/ecma262/#sec-math.asinh
15
17
  // Tor Browser bug: Math.asinh(0) -> -0
16
- $({ target: 'Math', stat: true, forced: !($asinh && 1 / $asinh(0) > 0) }, {
18
+ $({ target: 'Math', stat: true, forced: FORCED }, {
17
19
  asinh: asinh
18
20
  });
@@ -4,10 +4,12 @@ var $ = require('../internals/export');
4
4
  var $atanh = Math.atanh;
5
5
  var log = Math.log;
6
6
 
7
+ var FORCED = !($atanh && 1 / $atanh(-0) < 0);
8
+
7
9
  // `Math.atanh` method
8
10
  // https://tc39.es/ecma262/#sec-math.atanh
9
11
  // Tor Browser bug: Math.atanh(-0) -> 0
10
- $({ target: 'Math', stat: true, forced: !($atanh && 1 / $atanh(-0) < 0) }, {
12
+ $({ target: 'Math', stat: true, forced: FORCED }, {
11
13
  atanh: function atanh(x) {
12
14
  var n = +x;
13
15
  return n == 0 ? n : log((1 + n) / (1 - n)) / 2;
@@ -6,9 +6,11 @@ var $cosh = Math.cosh;
6
6
  var abs = Math.abs;
7
7
  var E = Math.E;
8
8
 
9
+ var FORCED = !$cosh || $cosh(710) === Infinity;
10
+
9
11
  // `Math.cosh` method
10
12
  // https://tc39.es/ecma262/#sec-math.cosh
11
- $({ target: 'Math', stat: true, forced: !$cosh || $cosh(710) === Infinity }, {
13
+ $({ target: 'Math', stat: true, forced: FORCED }, {
12
14
  cosh: function cosh(x) {
13
15
  var t = expm1(abs(x) - 1) + 1;
14
16
  return (t + 1 / (t * E * E)) * (E / 2);
@@ -7,11 +7,11 @@ var sqrt = Math.sqrt;
7
7
 
8
8
  // Chrome 77 bug
9
9
  // https://bugs.chromium.org/p/v8/issues/detail?id=9546
10
- var BUGGY = !!$hypot && $hypot(Infinity, NaN) !== Infinity;
10
+ var FORCED = !!$hypot && $hypot(Infinity, NaN) !== Infinity;
11
11
 
12
12
  // `Math.hypot` method
13
13
  // https://tc39.es/ecma262/#sec-math.hypot
14
- $({ target: 'Math', stat: true, arity: 2, forced: BUGGY }, {
14
+ $({ target: 'Math', stat: true, arity: 2, forced: FORCED }, {
15
15
  // eslint-disable-next-line no-unused-vars -- required for `.length`
16
16
  hypot: function hypot(value1, value2) {
17
17
  var sum = 0;
@@ -28,20 +28,23 @@ var ROUNDS_PROPERLY = nativeToExponential(-6.9e-11, 4) === '-6.9000e-11'
28
28
  && nativeToExponential(25, 0) === '3e+1';
29
29
 
30
30
  // IE8-
31
- var THROWS_ON_INFINITY_FRACTION = fails(function () {
32
- nativeToExponential(1, Infinity);
33
- }) && fails(function () {
34
- nativeToExponential(1, -Infinity);
35
- });
31
+ var throwsOnInfinityFraction = function () {
32
+ return fails(function () {
33
+ nativeToExponential(1, Infinity);
34
+ }) && fails(function () {
35
+ nativeToExponential(1, -Infinity);
36
+ });
37
+ };
36
38
 
37
39
  // Safari <11 && FF <50
38
- var PROPER_NON_FINITE_THIS_CHECK = !fails(function () {
39
- nativeToExponential(Infinity, Infinity);
40
- }) && !fails(function () {
41
- nativeToExponential(NaN, Infinity);
42
- });
40
+ var properNonFiniteThisCheck = function () {
41
+ return !fails(function () {
42
+ nativeToExponential(Infinity, Infinity);
43
+ nativeToExponential(NaN, Infinity);
44
+ });
45
+ };
43
46
 
44
- var FORCED = !ROUNDS_PROPERLY || !THROWS_ON_INFINITY_FRACTION || !PROPER_NON_FINITE_THIS_CHECK;
47
+ var FORCED = !ROUNDS_PROPERLY || !throwsOnInfinityFraction() || !properNonFiniteThisCheck();
45
48
 
46
49
  // `Number.prototype.toExponential` method
47
50
  // https://tc39.es/ecma262/#sec-number.prototype.toexponential
@@ -4,8 +4,7 @@ var toIndexedObject = require('../internals/to-indexed-object');
4
4
  var nativeGetOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
5
5
  var DESCRIPTORS = require('../internals/descriptors');
6
6
 
7
- var FAILS_ON_PRIMITIVES = fails(function () { nativeGetOwnPropertyDescriptor(1); });
8
- var FORCED = !DESCRIPTORS || FAILS_ON_PRIMITIVES;
7
+ var FORCED = !DESCRIPTORS || fails(function () { nativeGetOwnPropertyDescriptor(1); });
9
8
 
10
9
  // `Object.getOwnPropertyDescriptor` method
11
10
  // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
@@ -6,11 +6,12 @@ var ARRAY_BUFFER_NON_EXTENSIBLE = require('../internals/array-buffer-non-extensi
6
6
 
7
7
  // eslint-disable-next-line es/no-object-isfrozen -- safe
8
8
  var $isFrozen = Object.isFrozen;
9
- var FAILS_ON_PRIMITIVES = fails(function () { $isFrozen(1); });
9
+
10
+ var FORCED = ARRAY_BUFFER_NON_EXTENSIBLE || fails(function () { $isFrozen(1); });
10
11
 
11
12
  // `Object.isFrozen` method
12
13
  // https://tc39.es/ecma262/#sec-object.isfrozen
13
- $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE }, {
14
+ $({ target: 'Object', stat: true, forced: FORCED }, {
14
15
  isFrozen: function isFrozen(it) {
15
16
  if (!isObject(it)) return true;
16
17
  if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer') return true;
@@ -6,11 +6,12 @@ var ARRAY_BUFFER_NON_EXTENSIBLE = require('../internals/array-buffer-non-extensi
6
6
 
7
7
  // eslint-disable-next-line es/no-object-issealed -- safe
8
8
  var $isSealed = Object.isSealed;
9
- var FAILS_ON_PRIMITIVES = fails(function () { $isSealed(1); });
9
+
10
+ var FORCED = ARRAY_BUFFER_NON_EXTENSIBLE || fails(function () { $isSealed(1); });
10
11
 
11
12
  // `Object.isSealed` method
12
13
  // https://tc39.es/ecma262/#sec-object.issealed
13
- $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE }, {
14
+ $({ target: 'Object', stat: true, forced: FORCED }, {
14
15
  isSealed: function isSealed(it) {
15
16
  if (!isObject(it)) return true;
16
17
  if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer') return true;
@@ -5,10 +5,11 @@ var aCallable = require('../internals/a-callable');
5
5
  var newPromiseCapabilityModule = require('../internals/new-promise-capability');
6
6
  var perform = require('../internals/perform');
7
7
  var iterate = require('../internals/iterate');
8
+ var PROMISE_STATICS_INCORRECT_ITERATION = require('../internals/promise-statics-incorrect-iteration');
8
9
 
9
10
  // `Promise.allSettled` method
10
11
  // https://tc39.es/ecma262/#sec-promise.allsettled
11
- $({ target: 'Promise', stat: true }, {
12
+ $({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
12
13
  allSettled: function allSettled(iterable) {
13
14
  var C = this;
14
15
  var capability = newPromiseCapabilityModule.f(C);
@@ -6,12 +6,13 @@ var getBuiltIn = require('../internals/get-built-in');
6
6
  var newPromiseCapabilityModule = require('../internals/new-promise-capability');
7
7
  var perform = require('../internals/perform');
8
8
  var iterate = require('../internals/iterate');
9
+ var PROMISE_STATICS_INCORRECT_ITERATION = require('../internals/promise-statics-incorrect-iteration');
9
10
 
10
11
  var PROMISE_ANY_ERROR = 'No one promise resolved';
11
12
 
12
13
  // `Promise.any` method
13
14
  // https://tc39.es/ecma262/#sec-promise.any
14
- $({ target: 'Promise', stat: true }, {
15
+ $({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
15
16
  any: function any(iterable) {
16
17
  var C = this;
17
18
  var AggregateError = getBuiltIn('AggregateError');
@@ -13,7 +13,7 @@ if (DESCRIPTORS && MISSED_STICKY) {
13
13
  defineBuiltInAccessor(RegExpPrototype, 'sticky', {
14
14
  configurable: true,
15
15
  get: function sticky() {
16
- if (this === RegExpPrototype) return undefined;
16
+ if (this === RegExpPrototype) return;
17
17
  // We can't use InternalStateModule.getterFor because
18
18
  // we don't add metadata for regexps created by a literal.
19
19
  if (classof(this) === 'RegExp') {
@@ -14,10 +14,11 @@ $({ target: 'String', stat: true }, {
14
14
  raw: function raw(template) {
15
15
  var rawTemplate = toIndexedObject(toObject(template).raw);
16
16
  var literalSegments = lengthOfArrayLike(rawTemplate);
17
+ if (!literalSegments) return '';
17
18
  var argumentsLength = arguments.length;
18
19
  var elements = [];
19
20
  var i = 0;
20
- while (literalSegments > i) {
21
+ while (true) {
21
22
  push(elements, toString(rawTemplate[i++]));
22
23
  if (i === literalSegments) return join(elements, '');
23
24
  if (i < argumentsLength) push(elements, toString(arguments[i]));
@@ -9,7 +9,7 @@ var stringSlice = uncurryThis(''.slice);
9
9
  var max = Math.max;
10
10
  var min = Math.min;
11
11
 
12
- // eslint-disable-next-line unicorn/prefer-string-slice, es/no-string-prototype-substr -- required for testing
12
+ // eslint-disable-next-line unicorn/prefer-string-slice -- required for testing
13
13
  var FORCED = !''.substr || 'ab'.substr(-1) !== 'b';
14
14
 
15
15
  // `String.prototype.substr` method
@@ -1,4 +1,5 @@
1
1
  'use strict';
2
+ var FREEZING = require('../internals/freezing');
2
3
  var global = require('../internals/global');
3
4
  var uncurryThis = require('../internals/function-uncurry-this');
4
5
  var defineBuiltIns = require('../internals/define-built-ins');
@@ -6,10 +7,26 @@ var InternalMetadataModule = require('../internals/internal-metadata');
6
7
  var collection = require('../internals/collection');
7
8
  var collectionWeak = require('../internals/collection-weak');
8
9
  var isObject = require('../internals/is-object');
9
- var isExtensible = require('../internals/object-is-extensible');
10
10
  var enforceInternalState = require('../internals/internal-state').enforce;
11
+ var fails = require('../internals/fails');
11
12
  var NATIVE_WEAK_MAP = require('../internals/weak-map-basic-detection');
12
13
 
14
+ var $Object = Object;
15
+ // eslint-disable-next-line es/no-array-isarray -- safe
16
+ var isArray = Array.isArray;
17
+ // eslint-disable-next-line es/no-object-isextensible -- safe
18
+ var isExtensible = $Object.isExtensible;
19
+ // eslint-disable-next-line es/no-object-isfrozen -- safe
20
+ var isFrozen = $Object.isFrozen;
21
+ // eslint-disable-next-line es/no-object-issealed -- safe
22
+ var isSealed = $Object.isSealed;
23
+ // eslint-disable-next-line es/no-object-freeze -- safe
24
+ var freeze = $Object.freeze;
25
+ // eslint-disable-next-line es/no-object-seal -- safe
26
+ var seal = $Object.seal;
27
+
28
+ var FROZEN = {};
29
+ var SEALED = {};
13
30
  var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;
14
31
  var InternalWeakMap;
15
32
 
@@ -22,18 +39,27 @@ var wrapper = function (init) {
22
39
  // `WeakMap` constructor
23
40
  // https://tc39.es/ecma262/#sec-weakmap-constructor
24
41
  var $WeakMap = collection('WeakMap', wrapper, collectionWeak);
42
+ var WeakMapPrototype = $WeakMap.prototype;
43
+ var nativeSet = uncurryThis(WeakMapPrototype.set);
44
+
45
+ // Chakra Edge bug: adding frozen arrays to WeakMap unfreeze them
46
+ var hasMSEdgeFreezingBug = function () {
47
+ return FREEZING && fails(function () {
48
+ var frozenArray = freeze([]);
49
+ nativeSet(new $WeakMap(), frozenArray, 1);
50
+ return !isFrozen(frozenArray);
51
+ });
52
+ };
25
53
 
26
54
  // IE11 WeakMap frozen keys fix
27
55
  // We can't use feature detection because it crash some old IE builds
28
56
  // https://github.com/zloirock/core-js/issues/485
29
- if (NATIVE_WEAK_MAP && IS_IE11) {
57
+ if (NATIVE_WEAK_MAP) if (IS_IE11) {
30
58
  InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true);
31
59
  InternalMetadataModule.enable();
32
- var WeakMapPrototype = $WeakMap.prototype;
33
60
  var nativeDelete = uncurryThis(WeakMapPrototype['delete']);
34
61
  var nativeHas = uncurryThis(WeakMapPrototype.has);
35
62
  var nativeGet = uncurryThis(WeakMapPrototype.get);
36
- var nativeSet = uncurryThis(WeakMapPrototype.set);
37
63
  defineBuiltIns(WeakMapPrototype, {
38
64
  'delete': function (key) {
39
65
  if (isObject(key) && !isExtensible(key)) {
@@ -65,4 +91,19 @@ if (NATIVE_WEAK_MAP && IS_IE11) {
65
91
  return this;
66
92
  }
67
93
  });
94
+ // Chakra Edge frozen keys fix
95
+ } else if (hasMSEdgeFreezingBug()) {
96
+ defineBuiltIns(WeakMapPrototype, {
97
+ set: function set(key, value) {
98
+ var arrayIntegrityLevel;
99
+ if (isArray(key)) {
100
+ if (isFrozen(key)) arrayIntegrityLevel = FROZEN;
101
+ else if (isSealed(key)) arrayIntegrityLevel = SEALED;
102
+ }
103
+ nativeSet(this, key, value);
104
+ if (arrayIntegrityLevel == FROZEN) freeze(key);
105
+ if (arrayIntegrityLevel == SEALED) seal(key);
106
+ return this;
107
+ }
108
+ });
68
109
  }
@@ -7,17 +7,15 @@ var copyConstructorProperties = require('../internals/copy-constructor-propertie
7
7
  var create = require('../internals/object-create');
8
8
  var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
9
9
  var createPropertyDescriptor = require('../internals/create-property-descriptor');
10
- var clearErrorStack = require('../internals/error-stack-clear');
11
10
  var installErrorCause = require('../internals/install-error-cause');
11
+ var installErrorStack = require('../internals/error-stack-install');
12
12
  var normalizeStringArgument = require('../internals/normalize-string-argument');
13
13
  var wellKnownSymbol = require('../internals/well-known-symbol');
14
- var ERROR_STACK_INSTALLABLE = require('../internals/error-stack-installable');
15
14
 
16
15
  var TO_STRING_TAG = wellKnownSymbol('toStringTag');
17
16
  var $Error = Error;
18
17
 
19
18
  var $SuppressedError = function SuppressedError(error, suppressed, message /* , options */) {
20
- var options = arguments.length > 3 ? arguments[3] : undefined;
21
19
  var isInstance = isPrototypeOf(SuppressedErrorPrototype, this);
22
20
  var that;
23
21
  if (setPrototypeOf) {
@@ -27,8 +25,8 @@ var $SuppressedError = function SuppressedError(error, suppressed, message /* ,
27
25
  createNonEnumerableProperty(that, TO_STRING_TAG, 'Error');
28
26
  }
29
27
  if (message !== undefined) createNonEnumerableProperty(that, 'message', normalizeStringArgument(message));
30
- if (ERROR_STACK_INSTALLABLE) createNonEnumerableProperty(that, 'stack', clearErrorStack(that.stack, 1));
31
- installErrorCause(that, options);
28
+ installErrorStack(that, $SuppressedError, that.stack, 1);
29
+ if (arguments.length > 3) installErrorCause(that, arguments[3]);
32
30
  createNonEnumerableProperty(that, 'error', error);
33
31
  createNonEnumerableProperty(that, 'suppressed', suppressed);
34
32
  return that;
@@ -1,6 +1,8 @@
1
1
  var $ = require('../internals/export');
2
+ var global = require('../internals/global');
2
3
  var getBuiltIn = require('../internals/get-built-in');
3
4
  var uncurryThis = require('../internals/function-uncurry-this');
5
+ var call = require('../internals/function-call');
4
6
  var fails = require('../internals/fails');
5
7
  var toString = require('../internals/to-string');
6
8
  var hasOwn = require('../internals/has-own-property');
@@ -33,10 +35,11 @@ var WRONG_ARITY = !NO_SPACES_IGNORE && !NO_ENCODING_CHECK && $atob.length !== 1;
33
35
 
34
36
  // `atob` method
35
37
  // https://html.spec.whatwg.org/multipage/webappapis.html#dom-atob
36
- $({ global: true, enumerable: true, forced: NO_SPACES_IGNORE || NO_ENCODING_CHECK || NO_ARG_RECEIVING_CHECK || WRONG_ARITY }, {
38
+ $({ global: true, bind: true, enumerable: true, forced: NO_SPACES_IGNORE || NO_ENCODING_CHECK || NO_ARG_RECEIVING_CHECK || WRONG_ARITY }, {
37
39
  atob: function atob(data) {
38
40
  validateArgumentsLength(arguments.length, 1);
39
- if (NO_ARG_RECEIVING_CHECK || WRONG_ARITY) return $atob(data);
41
+ // `webpack` dev server bug on IE global methods - use call(fn, global, ...)
42
+ if (NO_ARG_RECEIVING_CHECK || WRONG_ARITY) return call($atob, global, data);
40
43
  var string = replace(toString(data), whitespaces, '');
41
44
  var output = '';
42
45
  var position = 0;
@@ -1,6 +1,8 @@
1
1
  var $ = require('../internals/export');
2
+ var global = require('../internals/global');
2
3
  var getBuiltIn = require('../internals/get-built-in');
3
4
  var uncurryThis = require('../internals/function-uncurry-this');
5
+ var call = require('../internals/function-call');
4
6
  var fails = require('../internals/fails');
5
7
  var toString = require('../internals/to-string');
6
8
  var validateArgumentsLength = require('../internals/validate-arguments-length');
@@ -22,10 +24,11 @@ var WRONG_ARITY = !!$btoa && $btoa.length !== 1;
22
24
 
23
25
  // `btoa` method
24
26
  // https://html.spec.whatwg.org/multipage/webappapis.html#dom-btoa
25
- $({ global: true, enumerable: true, forced: NO_ARG_RECEIVING_CHECK || WRONG_ARG_CONVERSION || WRONG_ARITY }, {
27
+ $({ global: true, bind: true, enumerable: true, forced: NO_ARG_RECEIVING_CHECK || WRONG_ARG_CONVERSION || WRONG_ARITY }, {
26
28
  btoa: function btoa(data) {
27
29
  validateArgumentsLength(arguments.length, 1);
28
- if (NO_ARG_RECEIVING_CHECK || WRONG_ARG_CONVERSION || WRONG_ARITY) return $btoa(toString(data));
30
+ // `webpack` dev server bug on IE global methods - use call(fn, global, ...)
31
+ if (NO_ARG_RECEIVING_CHECK || WRONG_ARG_CONVERSION || WRONG_ARITY) return call($btoa, global, toString(data));
29
32
  var string = toString(data);
30
33
  var output = '';
31
34
  var position = 0;
@@ -80,8 +80,11 @@ var getterFor = function (key) {
80
80
  };
81
81
 
82
82
  if (DESCRIPTORS) {
83
+ // `DOMException.prototype.code` getter
83
84
  defineBuiltInAccessor(DOMExceptionPrototype, 'code', getterFor('code'));
85
+ // `DOMException.prototype.message` getter
84
86
  defineBuiltInAccessor(DOMExceptionPrototype, 'message', getterFor('message'));
87
+ // `DOMException.prototype.name` getter
85
88
  defineBuiltInAccessor(DOMExceptionPrototype, 'name', getterFor('name'));
86
89
  }
87
90
 
@@ -128,6 +131,7 @@ if (INCORRECT_CODE && DESCRIPTORS && NativeDOMException === PolyfilledDOMExcepti
128
131
  }));
129
132
  }
130
133
 
134
+ // `DOMException` constants
131
135
  for (var key in DOMExceptionConstants) if (hasOwn(DOMExceptionConstants, key)) {
132
136
  var constant = DOMExceptionConstants[key];
133
137
  var constantName = constant.s;
@@ -3,4 +3,5 @@ var setToStringTag = require('../internals/set-to-string-tag');
3
3
 
4
4
  var DOM_EXCEPTION = 'DOMException';
5
5
 
6
+ // `DOMException.prototype[@@toStringTag]` property
6
7
  setToStringTag(getBuiltIn(DOM_EXCEPTION), DOM_EXCEPTION);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "core-js",
3
- "version": "3.27.0",
3
+ "version": "3.27.2",
4
4
  "description": "Standard library",
5
5
  "keywords": [
6
6
  "ES3",
package/postinstall.js CHANGED
@@ -1,8 +1,8 @@
1
1
  var fs = require('fs');
2
2
  var os = require('os');
3
3
  var path = require('path');
4
- var env = process.env;
5
4
 
5
+ var env = process.env;
6
6
  var ADBLOCK = is(env.ADBLOCK);
7
7
  var COLOR = is(env.npm_config_color);
8
8
  var DISABLE_OPENCOLLECTIVE = is(env.DISABLE_OPENCOLLECTIVE);