core-js 3.8.3 → 3.9.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 (107) hide show
  1. package/es/json/stringify.js +1 -1
  2. package/features/array/find-last-index.js +4 -0
  3. package/features/array/find-last.js +4 -0
  4. package/features/array/index.js +2 -0
  5. package/features/array/virtual/find-last-index.js +4 -0
  6. package/features/array/virtual/find-last.js +4 -0
  7. package/features/array/virtual/index.js +3 -0
  8. package/features/instance/find-last-index.js +8 -0
  9. package/features/instance/find-last.js +8 -0
  10. package/features/typed-array/find-last-index.js +1 -0
  11. package/features/typed-array/find-last.js +1 -0
  12. package/features/typed-array/index.js +4 -0
  13. package/features/typed-array/unique-by.js +2 -0
  14. package/internals/array-buffer-view-core.js +1 -1
  15. package/internals/array-buffer.js +6 -4
  16. package/internals/array-for-each.js +1 -3
  17. package/internals/array-includes.js +2 -2
  18. package/internals/array-iteration-from-last.js +34 -0
  19. package/internals/array-last-index-of.js +1 -4
  20. package/internals/array-method-is-strict.js +1 -1
  21. package/internals/array-unique-by.js +32 -0
  22. package/internals/async-iterator-prototype.js +1 -1
  23. package/internals/check-correctness-of-iteration.js +1 -1
  24. package/internals/collection.js +9 -5
  25. package/internals/fix-regexp-well-known-symbol-logic.js +1 -0
  26. package/internals/function-bind.js +1 -1
  27. package/internals/get-map-iterator.js +1 -1
  28. package/internals/get-set-iterator.js +1 -1
  29. package/internals/global.js +2 -2
  30. package/internals/ieee754.js +2 -4
  31. package/internals/indexed-object.js +1 -1
  32. package/internals/is-iterable.js +1 -1
  33. package/internals/math-fround.js +1 -1
  34. package/internals/math-scale.js +2 -2
  35. package/internals/math-sign.js +1 -1
  36. package/internals/native-symbol.js +1 -1
  37. package/internals/object-assign.js +2 -2
  38. package/internals/object-create.js +1 -1
  39. package/internals/object-prototype-accessors-forced.js +1 -1
  40. package/internals/object-set-prototype-of.js +1 -1
  41. package/internals/range-iterator.js +1 -1
  42. package/internals/regexp-exec.js +1 -0
  43. package/internals/same-value-zero.js +1 -1
  44. package/internals/same-value.js +1 -1
  45. package/internals/shared.js +1 -1
  46. package/internals/string-pad-webkit-bug.js +1 -1
  47. package/internals/string-punycode-to-ascii.js +1 -1
  48. package/internals/task.js +2 -2
  49. package/internals/typed-array-constructors-require-wrappers.js +1 -1
  50. package/internals/typed-array-from-species-and-list.js +11 -0
  51. package/internals/use-symbol-as-uid.js +1 -2
  52. package/internals/whitespaces.js +2 -2
  53. package/modules/es.aggregate-error.js +1 -1
  54. package/modules/es.array.concat.js +2 -1
  55. package/modules/es.array.every.js +1 -3
  56. package/modules/es.array.filter.js +1 -4
  57. package/modules/es.array.find-index.js +1 -4
  58. package/modules/es.array.find.js +1 -4
  59. package/modules/es.array.includes.js +1 -4
  60. package/modules/es.array.index-of.js +1 -3
  61. package/modules/es.array.map.js +1 -4
  62. package/modules/es.array.reduce-right.js +1 -4
  63. package/modules/es.array.reduce.js +1 -3
  64. package/modules/es.array.reverse.js +1 -1
  65. package/modules/es.array.slice.js +1 -3
  66. package/modules/es.array.some.js +1 -3
  67. package/modules/es.array.splice.js +1 -3
  68. package/modules/es.date.to-json.js +1 -1
  69. package/modules/es.date.to-string.js +1 -1
  70. package/modules/es.json.stringify.js +1 -1
  71. package/modules/es.math.hypot.js +2 -1
  72. package/modules/es.number.is-nan.js +1 -1
  73. package/modules/es.number.to-fixed.js +43 -44
  74. package/modules/es.promise.js +2 -2
  75. package/modules/es.reflect.define-property.js +1 -1
  76. package/modules/es.reflect.set.js +1 -1
  77. package/modules/es.string.from-code-point.js +2 -1
  78. package/modules/es.string.match-all.js +1 -1
  79. package/modules/es.string.split.js +2 -0
  80. package/modules/es.symbol.js +1 -1
  81. package/modules/es.typed-array.fill.js +1 -1
  82. package/modules/es.typed-array.filter.js +2 -8
  83. package/modules/es.typed-array.join.js +1 -1
  84. package/modules/es.typed-array.last-index-of.js +1 -1
  85. package/modules/es.typed-array.set.js +1 -1
  86. package/modules/es.typed-array.slice.js +1 -1
  87. package/modules/esnext.array.find-last-index.js +14 -0
  88. package/modules/esnext.array.find-last.js +14 -0
  89. package/modules/esnext.array.unique-by.js +2 -28
  90. package/modules/esnext.bigint.range.js +1 -1
  91. package/modules/esnext.map.merge.js +1 -1
  92. package/modules/esnext.typed-array.filter-out.js +2 -8
  93. package/modules/esnext.typed-array.find-last-index.js +12 -0
  94. package/modules/esnext.typed-array.find-last.js +12 -0
  95. package/modules/esnext.typed-array.unique-by.js +13 -0
  96. package/modules/web.timers.js +1 -1
  97. package/modules/web.url.js +9 -11
  98. package/package.json +2 -2
  99. package/postinstall.js +2 -2
  100. package/proposals/array-find-from-last.js +5 -0
  101. package/proposals/array-unique.js +1 -0
  102. package/stable/instance/entries.js +1 -1
  103. package/stable/instance/for-each.js +1 -1
  104. package/stable/instance/keys.js +1 -1
  105. package/stable/instance/values.js +1 -1
  106. package/stage/1.js +1 -0
  107. package/internals/array-method-uses-to-length.js +0 -27
@@ -11,7 +11,7 @@ var $AggregateError = function AggregateError(errors, message) {
11
11
  var that = this;
12
12
  if (!(that instanceof $AggregateError)) return new $AggregateError(errors, message);
13
13
  if (setPrototypeOf) {
14
- // eslint-disable-next-line unicorn/error-message
14
+ // eslint-disable-next-line unicorn/error-message -- expected
15
15
  that = setPrototypeOf(new Error(undefined), getPrototypeOf(that));
16
16
  }
17
17
  if (message !== undefined) createNonEnumerableProperty(that, 'message', String(message));
@@ -38,7 +38,8 @@ var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
38
38
  // https://tc39.es/ecma262/#sec-array.prototype.concat
39
39
  // with adding support of @@isConcatSpreadable and @@species
40
40
  $({ target: 'Array', proto: true, forced: FORCED }, {
41
- concat: function concat(arg) { // eslint-disable-line no-unused-vars
41
+ // eslint-disable-next-line no-unused-vars -- required for `.length`
42
+ concat: function concat(arg) {
42
43
  var O = toObject(this);
43
44
  var A = arraySpeciesCreate(O, 0);
44
45
  var n = 0;
@@ -2,14 +2,12 @@
2
2
  var $ = require('../internals/export');
3
3
  var $every = require('../internals/array-iteration').every;
4
4
  var arrayMethodIsStrict = require('../internals/array-method-is-strict');
5
- var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');
6
5
 
7
6
  var STRICT_METHOD = arrayMethodIsStrict('every');
8
- var USES_TO_LENGTH = arrayMethodUsesToLength('every');
9
7
 
10
8
  // `Array.prototype.every` method
11
9
  // https://tc39.es/ecma262/#sec-array.prototype.every
12
- $({ target: 'Array', proto: true, forced: !STRICT_METHOD || !USES_TO_LENGTH }, {
10
+ $({ target: 'Array', proto: true, forced: !STRICT_METHOD }, {
13
11
  every: function every(callbackfn /* , thisArg */) {
14
12
  return $every(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
15
13
  }
@@ -2,16 +2,13 @@
2
2
  var $ = require('../internals/export');
3
3
  var $filter = require('../internals/array-iteration').filter;
4
4
  var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
5
- var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');
6
5
 
7
6
  var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
8
- // Edge 14- issue
9
- var USES_TO_LENGTH = arrayMethodUsesToLength('filter');
10
7
 
11
8
  // `Array.prototype.filter` method
12
9
  // https://tc39.es/ecma262/#sec-array.prototype.filter
13
10
  // with adding support of @@species
14
- $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {
11
+ $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
15
12
  filter: function filter(callbackfn /* , thisArg */) {
16
13
  return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
17
14
  }
@@ -2,19 +2,16 @@
2
2
  var $ = require('../internals/export');
3
3
  var $findIndex = require('../internals/array-iteration').findIndex;
4
4
  var addToUnscopables = require('../internals/add-to-unscopables');
5
- var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');
6
5
 
7
6
  var FIND_INDEX = 'findIndex';
8
7
  var SKIPS_HOLES = true;
9
8
 
10
- var USES_TO_LENGTH = arrayMethodUsesToLength(FIND_INDEX);
11
-
12
9
  // Shouldn't skip holes
13
10
  if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES = false; });
14
11
 
15
12
  // `Array.prototype.findIndex` method
16
13
  // https://tc39.es/ecma262/#sec-array.prototype.findindex
17
- $({ target: 'Array', proto: true, forced: SKIPS_HOLES || !USES_TO_LENGTH }, {
14
+ $({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
18
15
  findIndex: function findIndex(callbackfn /* , that = undefined */) {
19
16
  return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
20
17
  }
@@ -2,19 +2,16 @@
2
2
  var $ = require('../internals/export');
3
3
  var $find = require('../internals/array-iteration').find;
4
4
  var addToUnscopables = require('../internals/add-to-unscopables');
5
- var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');
6
5
 
7
6
  var FIND = 'find';
8
7
  var SKIPS_HOLES = true;
9
8
 
10
- var USES_TO_LENGTH = arrayMethodUsesToLength(FIND);
11
-
12
9
  // Shouldn't skip holes
13
10
  if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
14
11
 
15
12
  // `Array.prototype.find` method
16
13
  // https://tc39.es/ecma262/#sec-array.prototype.find
17
- $({ target: 'Array', proto: true, forced: SKIPS_HOLES || !USES_TO_LENGTH }, {
14
+ $({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
18
15
  find: function find(callbackfn /* , that = undefined */) {
19
16
  return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
20
17
  }
@@ -2,13 +2,10 @@
2
2
  var $ = require('../internals/export');
3
3
  var $includes = require('../internals/array-includes').includes;
4
4
  var addToUnscopables = require('../internals/add-to-unscopables');
5
- var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');
6
-
7
- var USES_TO_LENGTH = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });
8
5
 
9
6
  // `Array.prototype.includes` method
10
7
  // https://tc39.es/ecma262/#sec-array.prototype.includes
11
- $({ target: 'Array', proto: true, forced: !USES_TO_LENGTH }, {
8
+ $({ target: 'Array', proto: true }, {
12
9
  includes: function includes(el /* , fromIndex = 0 */) {
13
10
  return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
14
11
  }
@@ -2,17 +2,15 @@
2
2
  var $ = require('../internals/export');
3
3
  var $indexOf = require('../internals/array-includes').indexOf;
4
4
  var arrayMethodIsStrict = require('../internals/array-method-is-strict');
5
- var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');
6
5
 
7
6
  var nativeIndexOf = [].indexOf;
8
7
 
9
8
  var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
10
9
  var STRICT_METHOD = arrayMethodIsStrict('indexOf');
11
- var USES_TO_LENGTH = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });
12
10
 
13
11
  // `Array.prototype.indexOf` method
14
12
  // https://tc39.es/ecma262/#sec-array.prototype.indexof
15
- $({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD || !USES_TO_LENGTH }, {
13
+ $({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD }, {
16
14
  indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
17
15
  return NEGATIVE_ZERO
18
16
  // convert -0 to +0
@@ -2,16 +2,13 @@
2
2
  var $ = require('../internals/export');
3
3
  var $map = require('../internals/array-iteration').map;
4
4
  var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
5
- var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');
6
5
 
7
6
  var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map');
8
- // FF49- issue
9
- var USES_TO_LENGTH = arrayMethodUsesToLength('map');
10
7
 
11
8
  // `Array.prototype.map` method
12
9
  // https://tc39.es/ecma262/#sec-array.prototype.map
13
10
  // with adding support of @@species
14
- $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {
11
+ $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
15
12
  map: function map(callbackfn /* , thisArg */) {
16
13
  return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
17
14
  }
@@ -2,20 +2,17 @@
2
2
  var $ = require('../internals/export');
3
3
  var $reduceRight = require('../internals/array-reduce').right;
4
4
  var arrayMethodIsStrict = require('../internals/array-method-is-strict');
5
- var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');
6
5
  var CHROME_VERSION = require('../internals/engine-v8-version');
7
6
  var IS_NODE = require('../internals/engine-is-node');
8
7
 
9
8
  var STRICT_METHOD = arrayMethodIsStrict('reduceRight');
10
- // For preventing possible almost infinite loop in non-standard implementations, test the forward version of the method
11
- var USES_TO_LENGTH = arrayMethodUsesToLength('reduce', { 1: 0 });
12
9
  // Chrome 80-82 has a critical bug
13
10
  // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
14
11
  var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;
15
12
 
16
13
  // `Array.prototype.reduceRight` method
17
14
  // https://tc39.es/ecma262/#sec-array.prototype.reduceright
18
- $({ target: 'Array', proto: true, forced: !STRICT_METHOD || !USES_TO_LENGTH || CHROME_BUG }, {
15
+ $({ target: 'Array', proto: true, forced: !STRICT_METHOD || CHROME_BUG }, {
19
16
  reduceRight: function reduceRight(callbackfn /* , initialValue */) {
20
17
  return $reduceRight(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
21
18
  }
@@ -2,19 +2,17 @@
2
2
  var $ = require('../internals/export');
3
3
  var $reduce = require('../internals/array-reduce').left;
4
4
  var arrayMethodIsStrict = require('../internals/array-method-is-strict');
5
- var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');
6
5
  var CHROME_VERSION = require('../internals/engine-v8-version');
7
6
  var IS_NODE = require('../internals/engine-is-node');
8
7
 
9
8
  var STRICT_METHOD = arrayMethodIsStrict('reduce');
10
- var USES_TO_LENGTH = arrayMethodUsesToLength('reduce', { 1: 0 });
11
9
  // Chrome 80-82 has a critical bug
12
10
  // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
13
11
  var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;
14
12
 
15
13
  // `Array.prototype.reduce` method
16
14
  // https://tc39.es/ecma262/#sec-array.prototype.reduce
17
- $({ target: 'Array', proto: true, forced: !STRICT_METHOD || !USES_TO_LENGTH || CHROME_BUG }, {
15
+ $({ target: 'Array', proto: true, forced: !STRICT_METHOD || CHROME_BUG }, {
18
16
  reduce: function reduce(callbackfn /* , initialValue */) {
19
17
  return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
20
18
  }
@@ -11,7 +11,7 @@ var test = [1, 2];
11
11
  // https://bugs.webkit.org/show_bug.cgi?id=188794
12
12
  $({ target: 'Array', proto: true, forced: String(test) === String(test.reverse()) }, {
13
13
  reverse: function reverse() {
14
- // eslint-disable-next-line no-self-assign
14
+ // eslint-disable-next-line no-self-assign -- dirty hack
15
15
  if (isArray(this)) this.length = this.length;
16
16
  return nativeReverse.call(this);
17
17
  }
@@ -8,10 +8,8 @@ var toIndexedObject = require('../internals/to-indexed-object');
8
8
  var createProperty = require('../internals/create-property');
9
9
  var wellKnownSymbol = require('../internals/well-known-symbol');
10
10
  var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
11
- var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');
12
11
 
13
12
  var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');
14
- var USES_TO_LENGTH = arrayMethodUsesToLength('slice', { ACCESSORS: true, 0: 0, 1: 2 });
15
13
 
16
14
  var SPECIES = wellKnownSymbol('species');
17
15
  var nativeSlice = [].slice;
@@ -20,7 +18,7 @@ var max = Math.max;
20
18
  // `Array.prototype.slice` method
21
19
  // https://tc39.es/ecma262/#sec-array.prototype.slice
22
20
  // fallback for not array-like ES3 strings and DOM objects
23
- $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {
21
+ $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
24
22
  slice: function slice(start, end) {
25
23
  var O = toIndexedObject(this);
26
24
  var length = toLength(O.length);
@@ -2,14 +2,12 @@
2
2
  var $ = require('../internals/export');
3
3
  var $some = require('../internals/array-iteration').some;
4
4
  var arrayMethodIsStrict = require('../internals/array-method-is-strict');
5
- var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');
6
5
 
7
6
  var STRICT_METHOD = arrayMethodIsStrict('some');
8
- var USES_TO_LENGTH = arrayMethodUsesToLength('some');
9
7
 
10
8
  // `Array.prototype.some` method
11
9
  // https://tc39.es/ecma262/#sec-array.prototype.some
12
- $({ target: 'Array', proto: true, forced: !STRICT_METHOD || !USES_TO_LENGTH }, {
10
+ $({ target: 'Array', proto: true, forced: !STRICT_METHOD }, {
13
11
  some: function some(callbackfn /* , thisArg */) {
14
12
  return $some(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
15
13
  }
@@ -7,10 +7,8 @@ var toObject = require('../internals/to-object');
7
7
  var arraySpeciesCreate = require('../internals/array-species-create');
8
8
  var createProperty = require('../internals/create-property');
9
9
  var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
10
- var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');
11
10
 
12
11
  var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice');
13
- var USES_TO_LENGTH = arrayMethodUsesToLength('splice', { ACCESSORS: true, 0: 0, 1: 2 });
14
12
 
15
13
  var max = Math.max;
16
14
  var min = Math.min;
@@ -20,7 +18,7 @@ var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';
20
18
  // `Array.prototype.splice` method
21
19
  // https://tc39.es/ecma262/#sec-array.prototype.splice
22
20
  // with adding support of @@species
23
- $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {
21
+ $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
24
22
  splice: function splice(start, deleteCount /* , ...items */) {
25
23
  var O = toObject(this);
26
24
  var len = toLength(O.length);
@@ -12,7 +12,7 @@ var FORCED = fails(function () {
12
12
  // `Date.prototype.toJSON` method
13
13
  // https://tc39.es/ecma262/#sec-date.prototype.tojson
14
14
  $({ target: 'Date', proto: true, forced: FORCED }, {
15
- // eslint-disable-next-line no-unused-vars
15
+ // eslint-disable-next-line no-unused-vars -- required for `.length`
16
16
  toJSON: function toJSON(key) {
17
17
  var O = toObject(this);
18
18
  var pv = toPrimitive(O);
@@ -11,7 +11,7 @@ var getTime = DatePrototype.getTime;
11
11
  if (new Date(NaN) + '' != INVALID_DATE) {
12
12
  redefine(DatePrototype, TO_STRING, function toString() {
13
13
  var value = getTime.call(this);
14
- // eslint-disable-next-line no-self-compare
14
+ // eslint-disable-next-line no-self-compare -- NaN check
15
15
  return value === value ? nativeDateToString.call(this) : INVALID_DATE;
16
16
  });
17
17
  }
@@ -25,7 +25,7 @@ if ($stringify) {
25
25
  // https://tc39.es/ecma262/#sec-json.stringify
26
26
  // https://github.com/tc39/proposal-well-formed-stringify
27
27
  $({ target: 'JSON', stat: true, forced: FORCED }, {
28
- // eslint-disable-next-line no-unused-vars
28
+ // eslint-disable-next-line no-unused-vars -- required for `.length`
29
29
  stringify: function stringify(it, replacer, space) {
30
30
  var result = $stringify.apply(null, arguments);
31
31
  return typeof result == 'string' ? result.replace(re, fix) : result;
@@ -11,7 +11,8 @@ var BUGGY = !!$hypot && $hypot(Infinity, NaN) !== Infinity;
11
11
  // `Math.hypot` method
12
12
  // https://tc39.es/ecma262/#sec-math.hypot
13
13
  $({ target: 'Math', stat: true, forced: BUGGY }, {
14
- hypot: function hypot(value1, value2) { // eslint-disable-line no-unused-vars
14
+ // eslint-disable-next-line no-unused-vars -- required for `.length`
15
+ hypot: function hypot(value1, value2) {
15
16
  var sum = 0;
16
17
  var i = 0;
17
18
  var aLen = arguments.length;
@@ -4,7 +4,7 @@ var $ = require('../internals/export');
4
4
  // https://tc39.es/ecma262/#sec-number.isnan
5
5
  $({ target: 'Number', stat: true }, {
6
6
  isNaN: function isNaN(number) {
7
- // eslint-disable-next-line no-self-compare
7
+ // eslint-disable-next-line no-self-compare -- NaN check
8
8
  return number != number;
9
9
  }
10
10
  });
@@ -25,6 +25,37 @@ var log = function (x) {
25
25
  } return n;
26
26
  };
27
27
 
28
+ var multiply = function (data, n, c) {
29
+ var index = -1;
30
+ var c2 = c;
31
+ while (++index < 6) {
32
+ c2 += n * data[index];
33
+ data[index] = c2 % 1e7;
34
+ c2 = floor(c2 / 1e7);
35
+ }
36
+ };
37
+
38
+ var divide = function (data, n) {
39
+ var index = 6;
40
+ var c = 0;
41
+ while (--index >= 0) {
42
+ c += data[index];
43
+ data[index] = floor(c / n);
44
+ c = (c % n) * 1e7;
45
+ }
46
+ };
47
+
48
+ var dataToString = function (data) {
49
+ var index = 6;
50
+ var s = '';
51
+ while (--index >= 0) {
52
+ if (s !== '' || index === 0 || data[index] !== 0) {
53
+ var t = String(data[index]);
54
+ s = s === '' ? t : s + repeat.call('0', 7 - t.length) + t;
55
+ }
56
+ } return s;
57
+ };
58
+
28
59
  var FORCED = nativeToFixed && (
29
60
  0.00008.toFixed(3) !== '0.000' ||
30
61
  0.9.toFixed(0) !== '1' ||
@@ -38,7 +69,6 @@ var FORCED = nativeToFixed && (
38
69
  // `Number.prototype.toFixed` method
39
70
  // https://tc39.es/ecma262/#sec-number.prototype.tofixed
40
71
  $({ target: 'Number', proto: true, forced: FORCED }, {
41
- // eslint-disable-next-line max-statements
42
72
  toFixed: function toFixed(fractionDigits) {
43
73
  var number = thisNumberValue(this);
44
74
  var fractDigits = toInteger(fractionDigits);
@@ -47,39 +77,8 @@ $({ target: 'Number', proto: true, forced: FORCED }, {
47
77
  var result = '0';
48
78
  var e, z, j, k;
49
79
 
50
- var multiply = function (n, c) {
51
- var index = -1;
52
- var c2 = c;
53
- while (++index < 6) {
54
- c2 += n * data[index];
55
- data[index] = c2 % 1e7;
56
- c2 = floor(c2 / 1e7);
57
- }
58
- };
59
-
60
- var divide = function (n) {
61
- var index = 6;
62
- var c = 0;
63
- while (--index >= 0) {
64
- c += data[index];
65
- data[index] = floor(c / n);
66
- c = (c % n) * 1e7;
67
- }
68
- };
69
-
70
- var dataToString = function () {
71
- var index = 6;
72
- var s = '';
73
- while (--index >= 0) {
74
- if (s !== '' || index === 0 || data[index] !== 0) {
75
- var t = String(data[index]);
76
- s = s === '' ? t : s + repeat.call('0', 7 - t.length) + t;
77
- }
78
- } return s;
79
- };
80
-
81
80
  if (fractDigits < 0 || fractDigits > 20) throw RangeError('Incorrect fraction digits');
82
- // eslint-disable-next-line no-self-compare
81
+ // eslint-disable-next-line no-self-compare -- NaN check
83
82
  if (number != number) return 'NaN';
84
83
  if (number <= -1e21 || number >= 1e21) return String(number);
85
84
  if (number < 0) {
@@ -92,26 +91,26 @@ $({ target: 'Number', proto: true, forced: FORCED }, {
92
91
  z *= 0x10000000000000;
93
92
  e = 52 - e;
94
93
  if (e > 0) {
95
- multiply(0, z);
94
+ multiply(data, 0, z);
96
95
  j = fractDigits;
97
96
  while (j >= 7) {
98
- multiply(1e7, 0);
97
+ multiply(data, 1e7, 0);
99
98
  j -= 7;
100
99
  }
101
- multiply(pow(10, j, 1), 0);
100
+ multiply(data, pow(10, j, 1), 0);
102
101
  j = e - 1;
103
102
  while (j >= 23) {
104
- divide(1 << 23);
103
+ divide(data, 1 << 23);
105
104
  j -= 23;
106
105
  }
107
- divide(1 << j);
108
- multiply(1, 1);
109
- divide(2);
110
- result = dataToString();
106
+ divide(data, 1 << j);
107
+ multiply(data, 1, 1);
108
+ divide(data, 2);
109
+ result = dataToString(data);
111
110
  } else {
112
- multiply(0, z);
113
- multiply(1 << -e, 0);
114
- result = dataToString() + repeat.call('0', fractDigits);
111
+ multiply(data, 0, z);
112
+ multiply(data, 1 << -e, 0);
113
+ result = dataToString(data) + repeat.call('0', fractDigits);
115
114
  }
116
115
  }
117
116
  if (fractDigits > 0) {
@@ -237,7 +237,7 @@ if (FORCED) {
237
237
  internalReject(state, error);
238
238
  }
239
239
  };
240
- // eslint-disable-next-line no-unused-vars
240
+ // eslint-disable-next-line no-unused-vars -- required for `.length`
241
241
  Internal = function Promise(executor) {
242
242
  setInternalState(this, {
243
243
  type: PROMISE,
@@ -297,7 +297,7 @@ if (FORCED) {
297
297
 
298
298
  // wrap fetch result
299
299
  if (typeof $fetch == 'function') $({ global: true, enumerable: true, forced: true }, {
300
- // eslint-disable-next-line no-unused-vars
300
+ // eslint-disable-next-line no-unused-vars -- required for `.length`
301
301
  fetch: function fetch(input /* , init */) {
302
302
  return promiseResolve(PromiseConstructor, $fetch.apply(global, arguments));
303
303
  }
@@ -7,7 +7,7 @@ var fails = require('../internals/fails');
7
7
 
8
8
  // MS Edge has broken Reflect.defineProperty - throwing instead of returning false
9
9
  var ERROR_INSTEAD_OF_FALSE = fails(function () {
10
- // eslint-disable-next-line no-undef
10
+ /* global Reflect -- required for testing */
11
11
  Reflect.defineProperty(definePropertyModule.f({}, 1, { value: 1 }), 1, { value: 2 });
12
12
  });
13
13
 
@@ -37,7 +37,7 @@ function set(target, propertyKey, V /* , receiver */) {
37
37
  var MS_EDGE_BUG = fails(function () {
38
38
  var Constructor = function () { /* empty */ };
39
39
  var object = definePropertyModule.f(new Constructor(), 'a', { configurable: true });
40
- // eslint-disable-next-line no-undef
40
+ /* global Reflect -- required for testing */
41
41
  return Reflect.set(Constructor.prototype, 'a', 1, object) !== false;
42
42
  });
43
43
 
@@ -10,7 +10,8 @@ var INCORRECT_LENGTH = !!nativeFromCodePoint && nativeFromCodePoint.length != 1;
10
10
  // `String.fromCodePoint` method
11
11
  // https://tc39.es/ecma262/#sec-string.fromcodepoint
12
12
  $({ target: 'String', stat: true, forced: INCORRECT_LENGTH }, {
13
- fromCodePoint: function fromCodePoint(x) { // eslint-disable-line no-unused-vars
13
+ // eslint-disable-next-line no-unused-vars -- required for `.length`
14
+ fromCodePoint: function fromCodePoint(x) {
14
15
  var elements = [];
15
16
  var length = arguments.length;
16
17
  var i = 0;
@@ -39,7 +39,7 @@ var regExpExec = function (R, S) {
39
39
  } return regExpBuiltinExec.call(R, S);
40
40
  };
41
41
 
42
- // eslint-disable-next-line max-len
42
+ // eslint-disable-next-line max-len -- ignore
43
43
  var $RegExpStringIterator = createIteratorConstructor(function RegExpStringIterator(regexp, string, global, fullUnicode) {
44
44
  setInternalState(this, {
45
45
  type: REGEXP_STRING_ITERATOR,
@@ -22,9 +22,11 @@ fixRegExpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCal
22
22
  var internalSplit;
23
23
  if (
24
24
  'abbc'.split(/(b)*/)[1] == 'c' ||
25
+ // eslint-disable-next-line regexp/no-empty-group -- required for testing
25
26
  'test'.split(/(?:)/, -1).length != 4 ||
26
27
  'ab'.split(/(?:ab)*/).length != 2 ||
27
28
  '.'.split(/(.?)(.?)/).length != 4 ||
29
+ // eslint-disable-next-line regexp/no-assertion-capturing-group, regexp/no-empty-group -- required for testing
28
30
  '.'.split(/()()/).length > 1 ||
29
31
  ''.split(/.?/).length
30
32
  ) {
@@ -281,7 +281,7 @@ if ($stringify) {
281
281
  });
282
282
 
283
283
  $({ target: 'JSON', stat: true, forced: FORCED_JSON_STRINGIFY }, {
284
- // eslint-disable-next-line no-unused-vars
284
+ // eslint-disable-next-line no-unused-vars -- required for `.length`
285
285
  stringify: function stringify(it, replacer, space) {
286
286
  var args = [it];
287
287
  var index = 1;
@@ -7,7 +7,7 @@ var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
7
7
 
8
8
  // `%TypedArray%.prototype.fill` method
9
9
  // https://tc39.es/ecma262/#sec-%typedarray%.prototype.fill
10
- // eslint-disable-next-line no-unused-vars
10
+ // eslint-disable-next-line no-unused-vars -- required for `.length`
11
11
  exportTypedArrayMethod('fill', function fill(value /* , start, end */) {
12
12
  return $fill.apply(aTypedArray(this), arguments);
13
13
  });
@@ -1,20 +1,14 @@
1
1
  'use strict';
2
2
  var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
3
3
  var $filter = require('../internals/array-iteration').filter;
4
- var speciesConstructor = require('../internals/species-constructor');
4
+ var fromSpeciesAndList = require('../internals/typed-array-from-species-and-list');
5
5
 
6
6
  var aTypedArray = ArrayBufferViewCore.aTypedArray;
7
- var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor;
8
7
  var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
9
8
 
10
9
  // `%TypedArray%.prototype.filter` method
11
10
  // https://tc39.es/ecma262/#sec-%typedarray%.prototype.filter
12
11
  exportTypedArrayMethod('filter', function filter(callbackfn /* , thisArg */) {
13
12
  var list = $filter(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
14
- var C = speciesConstructor(this, this.constructor);
15
- var index = 0;
16
- var length = list.length;
17
- var result = new (aTypedArrayConstructor(C))(length);
18
- while (length > index) result[index] = list[index++];
19
- return result;
13
+ return fromSpeciesAndList(this, list);
20
14
  });
@@ -7,7 +7,7 @@ var $join = [].join;
7
7
 
8
8
  // `%TypedArray%.prototype.join` method
9
9
  // https://tc39.es/ecma262/#sec-%typedarray%.prototype.join
10
- // eslint-disable-next-line no-unused-vars
10
+ // eslint-disable-next-line no-unused-vars -- required for `.length`
11
11
  exportTypedArrayMethod('join', function join(separator) {
12
12
  return $join.apply(aTypedArray(this), arguments);
13
13
  });
@@ -7,7 +7,7 @@ var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
7
7
 
8
8
  // `%TypedArray%.prototype.lastIndexOf` method
9
9
  // https://tc39.es/ecma262/#sec-%typedarray%.prototype.lastindexof
10
- // eslint-disable-next-line no-unused-vars
10
+ // eslint-disable-next-line no-unused-vars -- required for `.length`
11
11
  exportTypedArrayMethod('lastIndexOf', function lastIndexOf(searchElement /* , fromIndex */) {
12
12
  return $lastIndexOf.apply(aTypedArray(this), arguments);
13
13
  });
@@ -9,7 +9,7 @@ var aTypedArray = ArrayBufferViewCore.aTypedArray;
9
9
  var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
10
10
 
11
11
  var FORCED = fails(function () {
12
- // eslint-disable-next-line no-undef
12
+ /* global Int8Array -- safe */
13
13
  new Int8Array(1).set({});
14
14
  });
15
15
 
@@ -9,7 +9,7 @@ var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
9
9
  var $slice = [].slice;
10
10
 
11
11
  var FORCED = fails(function () {
12
- // eslint-disable-next-line no-undef
12
+ /* global Int8Array -- safe */
13
13
  new Int8Array(1).slice();
14
14
  });
15
15
 
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+ var $ = require('../internals/export');
3
+ var $findLastIndex = require('../internals/array-iteration-from-last').findLastIndex;
4
+ var addToUnscopables = require('../internals/add-to-unscopables');
5
+
6
+ // `Array.prototype.findLastIndex` method
7
+ // https://github.com/tc39/proposal-array-find-from-last
8
+ $({ target: 'Array', proto: true }, {
9
+ findLastIndex: function findLastIndex(callbackfn /* , that = undefined */) {
10
+ return $findLastIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
11
+ }
12
+ });
13
+
14
+ addToUnscopables('findLastIndex');
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+ var $ = require('../internals/export');
3
+ var $findLast = require('../internals/array-iteration-from-last').findLast;
4
+ var addToUnscopables = require('../internals/add-to-unscopables');
5
+
6
+ // `Array.prototype.findLast` method
7
+ // https://github.com/tc39/proposal-array-find-from-last
8
+ $({ target: 'Array', proto: true }, {
9
+ findLast: function findLast(callbackfn /* , that = undefined */) {
10
+ return $findLast(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
11
+ }
12
+ });
13
+
14
+ addToUnscopables('findLast');