core-js 3.40.0 → 3.42.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 (78) hide show
  1. package/actual/data-view/get-float16.js +3 -0
  2. package/actual/data-view/set-float16.js +3 -0
  3. package/actual/math/f16round.js +2 -2
  4. package/actual/regexp/escape.js +2 -2
  5. package/es/data-view/get-float16.js +2 -0
  6. package/es/data-view/index.js +2 -0
  7. package/es/data-view/set-float16.js +2 -0
  8. package/es/index.js +4 -0
  9. package/es/math/f16round.js +5 -0
  10. package/es/math/index.js +1 -0
  11. package/es/regexp/escape.js +5 -0
  12. package/es/regexp/index.js +1 -0
  13. package/full/index.js +4 -0
  14. package/internals/a-number.js +7 -0
  15. package/internals/a-weak-key.js +12 -0
  16. package/internals/async-from-sync-iterator.js +15 -4
  17. package/internals/iterator-helper-without-closing-on-early-error.js +23 -0
  18. package/internals/iterator-indexed.js +2 -1
  19. package/internals/set-method-accept-set-like.js +3 -1
  20. package/internals/shared-store.js +2 -2
  21. package/modules/es.data-view.get-float16.js +31 -0
  22. package/modules/es.data-view.set-float16.js +54 -0
  23. package/modules/es.iterator.drop.js +14 -2
  24. package/modules/es.iterator.every.js +14 -2
  25. package/modules/es.iterator.filter.js +13 -2
  26. package/modules/es.iterator.find.js +14 -2
  27. package/modules/es.iterator.flat-map.js +12 -2
  28. package/modules/es.iterator.for-each.js +14 -2
  29. package/modules/es.iterator.map.js +32 -3
  30. package/modules/es.iterator.reduce.js +23 -3
  31. package/modules/es.iterator.some.js +14 -2
  32. package/modules/es.iterator.take.js +13 -2
  33. package/modules/es.map.group-by.js +1 -0
  34. package/modules/es.math.f16round.js +15 -0
  35. package/modules/es.object.group-by.js +1 -0
  36. package/modules/es.regexp.escape.js +70 -0
  37. package/modules/es.string.match-all.js +2 -2
  38. package/modules/es.string.match.js +2 -2
  39. package/modules/es.string.replace-all.js +2 -2
  40. package/modules/es.string.replace.js +2 -2
  41. package/modules/es.string.search.js +2 -2
  42. package/modules/es.string.split.js +2 -2
  43. package/modules/esnext.async-disposable-stack.constructor.js +6 -1
  44. package/modules/esnext.async-iterator.drop.js +1 -2
  45. package/modules/esnext.async-iterator.every.js +1 -1
  46. package/modules/esnext.async-iterator.filter.js +1 -2
  47. package/modules/esnext.async-iterator.find.js +1 -1
  48. package/modules/esnext.async-iterator.flat-map.js +2 -3
  49. package/modules/esnext.async-iterator.for-each.js +1 -1
  50. package/modules/esnext.async-iterator.from.js +1 -2
  51. package/modules/esnext.async-iterator.map.js +1 -2
  52. package/modules/esnext.async-iterator.reduce.js +1 -1
  53. package/modules/esnext.async-iterator.some.js +1 -1
  54. package/modules/esnext.async-iterator.take.js +1 -2
  55. package/modules/esnext.async-iterator.to-array.js +1 -1
  56. package/modules/esnext.data-view.get-float16.js +2 -30
  57. package/modules/esnext.data-view.set-float16.js +2 -53
  58. package/modules/esnext.iterator.to-async.js +1 -2
  59. package/modules/esnext.json.is-raw-json.js +1 -1
  60. package/modules/esnext.json.raw-json.js +2 -2
  61. package/modules/esnext.math.clamp.js +13 -5
  62. package/modules/esnext.math.f16round.js +2 -14
  63. package/modules/esnext.regexp.escape.js +2 -70
  64. package/modules/esnext.uint8-array.set-from-base64.js +10 -1
  65. package/modules/esnext.weak-map.get-or-insert-computed.js +2 -1
  66. package/package.json +1 -1
  67. package/proposals/math-clamp.js +3 -0
  68. package/stable/data-view/get-float16.js +4 -0
  69. package/stable/data-view/set-float16.js +4 -0
  70. package/stable/index.js +4 -0
  71. package/stable/math/f16round.js +4 -0
  72. package/stable/regexp/escape.js +4 -0
  73. package/stage/1.js +1 -0
  74. package/stage/2.7.js +1 -0
  75. package/stage/2.js +0 -1
  76. package/stage/3.js +0 -2
  77. package/stage/4.js +2 -0
  78. package/internals/iterator-map.js +0 -24
@@ -1,16 +1,28 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
+ var call = require('../internals/function-call');
3
4
  var iterate = require('../internals/iterate');
4
5
  var aCallable = require('../internals/a-callable');
5
6
  var anObject = require('../internals/an-object');
6
7
  var getIteratorDirect = require('../internals/get-iterator-direct');
8
+ var iteratorClose = require('../internals/iterator-close');
9
+ var iteratorHelperWithoutClosingOnEarlyError = require('../internals/iterator-helper-without-closing-on-early-error');
10
+
11
+ var someWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError('some', TypeError);
7
12
 
8
13
  // `Iterator.prototype.some` method
9
14
  // https://tc39.es/ecma262/#sec-iterator.prototype.some
10
- $({ target: 'Iterator', proto: true, real: true }, {
15
+ $({ target: 'Iterator', proto: true, real: true, forced: someWithoutClosingOnEarlyError }, {
11
16
  some: function some(predicate) {
12
17
  anObject(this);
13
- aCallable(predicate);
18
+ try {
19
+ aCallable(predicate);
20
+ } catch (error) {
21
+ iteratorClose(this, 'throw', error);
22
+ }
23
+
24
+ if (someWithoutClosingOnEarlyError) return call(someWithoutClosingOnEarlyError, this, predicate);
25
+
14
26
  var record = getIteratorDirect(this);
15
27
  var counter = 0;
16
28
  return iterate(record, function (value, stop) {
@@ -7,8 +7,11 @@ var notANaN = require('../internals/not-a-nan');
7
7
  var toPositiveInteger = require('../internals/to-positive-integer');
8
8
  var createIteratorProxy = require('../internals/iterator-create-proxy');
9
9
  var iteratorClose = require('../internals/iterator-close');
10
+ var iteratorHelperWithoutClosingOnEarlyError = require('../internals/iterator-helper-without-closing-on-early-error');
10
11
  var IS_PURE = require('../internals/is-pure');
11
12
 
13
+ var takeWithoutClosingOnEarlyError = !IS_PURE && iteratorHelperWithoutClosingOnEarlyError('take', RangeError);
14
+
12
15
  var IteratorProxy = createIteratorProxy(function () {
13
16
  var iterator = this.iterator;
14
17
  if (!this.remaining--) {
@@ -22,10 +25,18 @@ var IteratorProxy = createIteratorProxy(function () {
22
25
 
23
26
  // `Iterator.prototype.take` method
24
27
  // https://tc39.es/ecma262/#sec-iterator.prototype.take
25
- $({ target: 'Iterator', proto: true, real: true, forced: IS_PURE }, {
28
+ $({ target: 'Iterator', proto: true, real: true, forced: IS_PURE || takeWithoutClosingOnEarlyError }, {
26
29
  take: function take(limit) {
27
30
  anObject(this);
28
- var remaining = toPositiveInteger(notANaN(+limit));
31
+ var remaining;
32
+ try {
33
+ remaining = toPositiveInteger(notANaN(+limit));
34
+ } catch (error) {
35
+ iteratorClose(this, 'throw', error);
36
+ }
37
+
38
+ if (takeWithoutClosingOnEarlyError) return call(takeWithoutClosingOnEarlyError, this, remaining);
39
+
29
40
  return new IteratorProxy(getIteratorDirect(this), {
30
41
  remaining: remaining
31
42
  });
@@ -14,6 +14,7 @@ var get = MapHelpers.get;
14
14
  var set = MapHelpers.set;
15
15
  var push = uncurryThis([].push);
16
16
 
17
+ // https://bugs.webkit.org/show_bug.cgi?id=271524
17
18
  var DOES_NOT_WORK_WITH_PRIMITIVES = IS_PURE || fails(function () {
18
19
  return Map.groupBy('ab', function (it) {
19
20
  return it;
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+ var $ = require('../internals/export');
3
+ var floatRound = require('../internals/math-float-round');
4
+
5
+ var FLOAT16_EPSILON = 0.0009765625;
6
+ var FLOAT16_MAX_VALUE = 65504;
7
+ var FLOAT16_MIN_VALUE = 6.103515625e-05;
8
+
9
+ // `Math.f16round` method
10
+ // https://tc39.es/ecma262/#sec-math.f16round
11
+ $({ target: 'Math', stat: true }, {
12
+ f16round: function f16round(x) {
13
+ return floatRound(x, FLOAT16_EPSILON, FLOAT16_MAX_VALUE, FLOAT16_MIN_VALUE);
14
+ }
15
+ });
@@ -13,6 +13,7 @@ var nativeGroupBy = Object.groupBy;
13
13
  var create = getBuiltIn('Object', 'create');
14
14
  var push = uncurryThis([].push);
15
15
 
16
+ // https://bugs.webkit.org/show_bug.cgi?id=271524
16
17
  var DOES_NOT_WORK_WITH_PRIMITIVES = !nativeGroupBy || fails(function () {
17
18
  return nativeGroupBy('ab', function (it) {
18
19
  return it;
@@ -0,0 +1,70 @@
1
+ 'use strict';
2
+ var $ = require('../internals/export');
3
+ var uncurryThis = require('../internals/function-uncurry-this');
4
+ var aString = require('../internals/a-string');
5
+ var hasOwn = require('../internals/has-own-property');
6
+ var padStart = require('../internals/string-pad').start;
7
+ var WHITESPACES = require('../internals/whitespaces');
8
+
9
+ var $Array = Array;
10
+ var $escape = RegExp.escape;
11
+ var charAt = uncurryThis(''.charAt);
12
+ var charCodeAt = uncurryThis(''.charCodeAt);
13
+ var numberToString = uncurryThis(1.1.toString);
14
+ var join = uncurryThis([].join);
15
+ var FIRST_DIGIT_OR_ASCII = /^[0-9a-z]/i;
16
+ var SYNTAX_SOLIDUS = /^[$()*+./?[\\\]^{|}]/;
17
+ var OTHER_PUNCTUATORS_AND_WHITESPACES = RegExp('^[!"#%&\',\\-:;<=>@`~' + WHITESPACES + ']');
18
+ var exec = uncurryThis(FIRST_DIGIT_OR_ASCII.exec);
19
+
20
+ var ControlEscape = {
21
+ '\u0009': 't',
22
+ '\u000A': 'n',
23
+ '\u000B': 'v',
24
+ '\u000C': 'f',
25
+ '\u000D': 'r'
26
+ };
27
+
28
+ var escapeChar = function (chr) {
29
+ var hex = numberToString(charCodeAt(chr, 0), 16);
30
+ return hex.length < 3 ? '\\x' + padStart(hex, 2, '0') : '\\u' + padStart(hex, 4, '0');
31
+ };
32
+
33
+ // Avoiding the use of polyfills of the previous iteration of this proposal
34
+ var FORCED = !$escape || $escape('ab') !== '\\x61b';
35
+
36
+ // `RegExp.escape` method
37
+ // https://tc39.es/ecma262/#sec-regexp.escape
38
+ $({ target: 'RegExp', stat: true, forced: FORCED }, {
39
+ escape: function escape(S) {
40
+ aString(S);
41
+ var length = S.length;
42
+ var result = $Array(length);
43
+
44
+ for (var i = 0; i < length; i++) {
45
+ var chr = charAt(S, i);
46
+ if (i === 0 && exec(FIRST_DIGIT_OR_ASCII, chr)) {
47
+ result[i] = escapeChar(chr);
48
+ } else if (hasOwn(ControlEscape, chr)) {
49
+ result[i] = '\\' + ControlEscape[chr];
50
+ } else if (exec(SYNTAX_SOLIDUS, chr)) {
51
+ result[i] = '\\' + chr;
52
+ } else if (exec(OTHER_PUNCTUATORS_AND_WHITESPACES, chr)) {
53
+ result[i] = escapeChar(chr);
54
+ } else {
55
+ var charCode = charCodeAt(chr, 0);
56
+ // single UTF-16 code unit
57
+ if ((charCode & 0xF800) !== 0xD800) result[i] = chr;
58
+ // unpaired surrogate
59
+ else if (charCode >= 0xDC00 || i + 1 >= length || (charCodeAt(S, i + 1) & 0xFC00) !== 0xDC00) result[i] = escapeChar(chr);
60
+ // surrogate pair
61
+ else {
62
+ result[i] = chr;
63
+ result[++i] = charAt(S, i);
64
+ }
65
+ }
66
+ }
67
+
68
+ return join(result, '');
69
+ }
70
+ });
@@ -9,7 +9,7 @@ var requireObjectCoercible = require('../internals/require-object-coercible');
9
9
  var toLength = require('../internals/to-length');
10
10
  var toString = require('../internals/to-string');
11
11
  var anObject = require('../internals/an-object');
12
- var isNullOrUndefined = require('../internals/is-null-or-undefined');
12
+ var isObject = require('../internals/is-object');
13
13
  var classof = require('../internals/classof-raw');
14
14
  var isRegExp = require('../internals/is-regexp');
15
15
  var getRegExpFlags = require('../internals/regexp-get-flags');
@@ -83,7 +83,7 @@ $({ target: 'String', proto: true, forced: WORKS_WITH_NON_GLOBAL_REGEX }, {
83
83
  matchAll: function matchAll(regexp) {
84
84
  var O = requireObjectCoercible(this);
85
85
  var flags, S, matcher, rx;
86
- if (!isNullOrUndefined(regexp)) {
86
+ if (isObject(regexp)) {
87
87
  if (isRegExp(regexp)) {
88
88
  flags = toString(requireObjectCoercible(getRegExpFlags(regexp)));
89
89
  if (!~stringIndexOf(flags, 'g')) throw new $TypeError('`.matchAll` does not allow non-global regexes');
@@ -2,7 +2,7 @@
2
2
  var call = require('../internals/function-call');
3
3
  var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');
4
4
  var anObject = require('../internals/an-object');
5
- var isNullOrUndefined = require('../internals/is-null-or-undefined');
5
+ var isObject = require('../internals/is-object');
6
6
  var toLength = require('../internals/to-length');
7
7
  var toString = require('../internals/to-string');
8
8
  var requireObjectCoercible = require('../internals/require-object-coercible');
@@ -17,7 +17,7 @@ fixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNa
17
17
  // https://tc39.es/ecma262/#sec-string.prototype.match
18
18
  function match(regexp) {
19
19
  var O = requireObjectCoercible(this);
20
- var matcher = isNullOrUndefined(regexp) ? undefined : getMethod(regexp, MATCH);
20
+ var matcher = isObject(regexp) ? getMethod(regexp, MATCH) : undefined;
21
21
  return matcher ? call(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString(O));
22
22
  },
23
23
  // `RegExp.prototype[@@match]` method
@@ -4,7 +4,7 @@ var call = require('../internals/function-call');
4
4
  var uncurryThis = require('../internals/function-uncurry-this');
5
5
  var requireObjectCoercible = require('../internals/require-object-coercible');
6
6
  var isCallable = require('../internals/is-callable');
7
- var isNullOrUndefined = require('../internals/is-null-or-undefined');
7
+ var isObject = require('../internals/is-object');
8
8
  var isRegExp = require('../internals/is-regexp');
9
9
  var toString = require('../internals/to-string');
10
10
  var getMethod = require('../internals/get-method');
@@ -28,7 +28,7 @@ $({ target: 'String', proto: true }, {
28
28
  var IS_REG_EXP, flags, replacer, string, searchString, functionalReplace, searchLength, advanceBy, position, replacement;
29
29
  var endOfLastMatch = 0;
30
30
  var result = '';
31
- if (!isNullOrUndefined(searchValue)) {
31
+ if (isObject(searchValue)) {
32
32
  IS_REG_EXP = isRegExp(searchValue);
33
33
  if (IS_REG_EXP) {
34
34
  flags = toString(requireObjectCoercible(getRegExpFlags(searchValue)));
@@ -6,7 +6,7 @@ var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-
6
6
  var fails = require('../internals/fails');
7
7
  var anObject = require('../internals/an-object');
8
8
  var isCallable = require('../internals/is-callable');
9
- var isNullOrUndefined = require('../internals/is-null-or-undefined');
9
+ var isObject = require('../internals/is-object');
10
10
  var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
11
11
  var toLength = require('../internals/to-length');
12
12
  var toString = require('../internals/to-string');
@@ -64,7 +64,7 @@ fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNa
64
64
  // https://tc39.es/ecma262/#sec-string.prototype.replace
65
65
  function replace(searchValue, replaceValue) {
66
66
  var O = requireObjectCoercible(this);
67
- var replacer = isNullOrUndefined(searchValue) ? undefined : getMethod(searchValue, REPLACE);
67
+ var replacer = isObject(searchValue) ? getMethod(searchValue, REPLACE) : undefined;
68
68
  return replacer
69
69
  ? call(replacer, searchValue, O, replaceValue)
70
70
  : call(nativeReplace, toString(O), searchValue, replaceValue);
@@ -2,7 +2,7 @@
2
2
  var call = require('../internals/function-call');
3
3
  var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');
4
4
  var anObject = require('../internals/an-object');
5
- var isNullOrUndefined = require('../internals/is-null-or-undefined');
5
+ var isObject = require('../internals/is-object');
6
6
  var requireObjectCoercible = require('../internals/require-object-coercible');
7
7
  var sameValue = require('../internals/same-value');
8
8
  var toString = require('../internals/to-string');
@@ -16,7 +16,7 @@ fixRegExpWellKnownSymbolLogic('search', function (SEARCH, nativeSearch, maybeCal
16
16
  // https://tc39.es/ecma262/#sec-string.prototype.search
17
17
  function search(regexp) {
18
18
  var O = requireObjectCoercible(this);
19
- var searcher = isNullOrUndefined(regexp) ? undefined : getMethod(regexp, SEARCH);
19
+ var searcher = isObject(regexp) ? getMethod(regexp, SEARCH) : undefined;
20
20
  return searcher ? call(searcher, regexp, O) : new RegExp(regexp)[SEARCH](toString(O));
21
21
  },
22
22
  // `RegExp.prototype[@@search]` method
@@ -3,7 +3,7 @@ var call = require('../internals/function-call');
3
3
  var uncurryThis = require('../internals/function-uncurry-this');
4
4
  var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');
5
5
  var anObject = require('../internals/an-object');
6
- var isNullOrUndefined = require('../internals/is-null-or-undefined');
6
+ var isObject = require('../internals/is-object');
7
7
  var requireObjectCoercible = require('../internals/require-object-coercible');
8
8
  var speciesConstructor = require('../internals/species-constructor');
9
9
  var advanceStringIndex = require('../internals/advance-string-index');
@@ -51,7 +51,7 @@ fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNa
51
51
  // https://tc39.es/ecma262/#sec-string.prototype.split
52
52
  function split(separator, limit) {
53
53
  var O = requireObjectCoercible(this);
54
- var splitter = isNullOrUndefined(separator) ? undefined : getMethod(separator, SPLIT);
54
+ var splitter = isObject(separator) ? getMethod(separator, SPLIT) : undefined;
55
55
  return splitter
56
56
  ? call(splitter, separator, O, limit)
57
57
  : call(internalSplit, toString(O), separator, limit);
@@ -11,6 +11,7 @@ var defineBuiltInAccessor = require('../internals/define-built-in-accessor');
11
11
  var wellKnownSymbol = require('../internals/well-known-symbol');
12
12
  var InternalStateModule = require('../internals/internal-state');
13
13
  var addDisposableResource = require('../internals/add-disposable-resource');
14
+ var V8_VERSION = require('../internals/environment-v8-version');
14
15
 
15
16
  var Promise = getBuiltIn('Promise');
16
17
  var SuppressedError = getBuiltIn('SuppressedError');
@@ -125,6 +126,10 @@ if (DESCRIPTORS) defineBuiltInAccessor(AsyncDisposableStackPrototype, 'disposed'
125
126
  defineBuiltIn(AsyncDisposableStackPrototype, ASYNC_DISPOSE, AsyncDisposableStackPrototype.disposeAsync, { name: 'disposeAsync' });
126
127
  defineBuiltIn(AsyncDisposableStackPrototype, TO_STRING_TAG, ASYNC_DISPOSABLE_STACK, { nonWritable: true });
127
128
 
128
- $({ global: true, constructor: true }, {
129
+ // https://github.com/tc39/proposal-explicit-resource-management/issues/256
130
+ // can't be detected synchronously
131
+ var SYNC_DISPOSE_RETURNING_PROMISE_RESOLUTION_BUG = V8_VERSION && V8_VERSION < 136;
132
+
133
+ $({ global: true, constructor: true, forced: SYNC_DISPOSE_RETURNING_PROMISE_RESOLUTION_BUG }, {
129
134
  AsyncDisposableStack: $AsyncDisposableStack
130
135
  });
@@ -7,7 +7,6 @@ var notANaN = require('../internals/not-a-nan');
7
7
  var toPositiveInteger = require('../internals/to-positive-integer');
8
8
  var createAsyncIteratorProxy = require('../internals/async-iterator-create-proxy');
9
9
  var createIterResultObject = require('../internals/create-iter-result-object');
10
- var IS_PURE = require('../internals/is-pure');
11
10
 
12
11
  var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise) {
13
12
  var state = this;
@@ -40,7 +39,7 @@ var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise) {
40
39
 
41
40
  // `AsyncIterator.prototype.drop` method
42
41
  // https://github.com/tc39/proposal-async-iterator-helpers
43
- $({ target: 'AsyncIterator', proto: true, real: true, forced: IS_PURE }, {
42
+ $({ target: 'AsyncIterator', proto: true, real: true, forced: true }, {
44
43
  drop: function drop(limit) {
45
44
  anObject(this);
46
45
  var remaining = toPositiveInteger(notANaN(+limit));
@@ -4,7 +4,7 @@ var $every = require('../internals/async-iterator-iteration').every;
4
4
 
5
5
  // `AsyncIterator.prototype.every` method
6
6
  // https://github.com/tc39/proposal-async-iterator-helpers
7
- $({ target: 'AsyncIterator', proto: true, real: true }, {
7
+ $({ target: 'AsyncIterator', proto: true, real: true, forced: true }, {
8
8
  every: function every(predicate) {
9
9
  return $every(this, predicate);
10
10
  }
@@ -8,7 +8,6 @@ var getIteratorDirect = require('../internals/get-iterator-direct');
8
8
  var createAsyncIteratorProxy = require('../internals/async-iterator-create-proxy');
9
9
  var createIterResultObject = require('../internals/create-iter-result-object');
10
10
  var closeAsyncIteration = require('../internals/async-iterator-close');
11
- var IS_PURE = require('../internals/is-pure');
12
11
 
13
12
  var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise) {
14
13
  var state = this;
@@ -56,7 +55,7 @@ var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise) {
56
55
 
57
56
  // `AsyncIterator.prototype.filter` method
58
57
  // https://github.com/tc39/proposal-async-iterator-helpers
59
- $({ target: 'AsyncIterator', proto: true, real: true, forced: IS_PURE }, {
58
+ $({ target: 'AsyncIterator', proto: true, real: true, forced: true }, {
60
59
  filter: function filter(predicate) {
61
60
  anObject(this);
62
61
  aCallable(predicate);
@@ -4,7 +4,7 @@ var $find = require('../internals/async-iterator-iteration').find;
4
4
 
5
5
  // `AsyncIterator.prototype.find` method
6
6
  // https://github.com/tc39/proposal-async-iterator-helpers
7
- $({ target: 'AsyncIterator', proto: true, real: true }, {
7
+ $({ target: 'AsyncIterator', proto: true, real: true, forced: true }, {
8
8
  find: function find(predicate) {
9
9
  return $find(this, predicate);
10
10
  }
@@ -9,7 +9,6 @@ var createAsyncIteratorProxy = require('../internals/async-iterator-create-proxy
9
9
  var createIterResultObject = require('../internals/create-iter-result-object');
10
10
  var getAsyncIteratorFlattenable = require('../internals/get-async-iterator-flattenable');
11
11
  var closeAsyncIteration = require('../internals/async-iterator-close');
12
- var IS_PURE = require('../internals/is-pure');
13
12
 
14
13
  var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise) {
15
14
  var state = this;
@@ -74,9 +73,9 @@ var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise) {
74
73
  });
75
74
  });
76
75
 
77
- // `AsyncIterator.prototype.flaMap` method
76
+ // `AsyncIterator.prototype.flatMap` method
78
77
  // https://github.com/tc39/proposal-async-iterator-helpers
79
- $({ target: 'AsyncIterator', proto: true, real: true, forced: IS_PURE }, {
78
+ $({ target: 'AsyncIterator', proto: true, real: true, forced: true }, {
80
79
  flatMap: function flatMap(mapper) {
81
80
  anObject(this);
82
81
  aCallable(mapper);
@@ -4,7 +4,7 @@ var $forEach = require('../internals/async-iterator-iteration').forEach;
4
4
 
5
5
  // `AsyncIterator.prototype.forEach` method
6
6
  // https://github.com/tc39/proposal-async-iterator-helpers
7
- $({ target: 'AsyncIterator', proto: true, real: true }, {
7
+ $({ target: 'AsyncIterator', proto: true, real: true, forced: true }, {
8
8
  forEach: function forEach(fn) {
9
9
  return $forEach(this, fn);
10
10
  }
@@ -5,11 +5,10 @@ var isPrototypeOf = require('../internals/object-is-prototype-of');
5
5
  var getAsyncIteratorFlattenable = require('../internals/get-async-iterator-flattenable');
6
6
  var AsyncIteratorPrototype = require('../internals/async-iterator-prototype');
7
7
  var WrapAsyncIterator = require('../internals/async-iterator-wrap');
8
- var IS_PURE = require('../internals/is-pure');
9
8
 
10
9
  // `AsyncIterator.from` method
11
10
  // https://github.com/tc39/proposal-async-iterator-helpers
12
- $({ target: 'AsyncIterator', stat: true, forced: IS_PURE }, {
11
+ $({ target: 'AsyncIterator', stat: true, forced: true }, {
13
12
  from: function from(O) {
14
13
  var iteratorRecord = getAsyncIteratorFlattenable(typeof O == 'string' ? toObject(O) : O);
15
14
  return isPrototypeOf(AsyncIteratorPrototype, iteratorRecord.iterator)
@@ -1,11 +1,10 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
3
  var map = require('../internals/async-iterator-map');
4
- var IS_PURE = require('../internals/is-pure');
5
4
 
6
5
  // `AsyncIterator.prototype.map` method
7
6
  // https://github.com/tc39/proposal-async-iterator-helpers
8
- $({ target: 'AsyncIterator', proto: true, real: true, forced: IS_PURE }, {
7
+ $({ target: 'AsyncIterator', proto: true, real: true, forced: true }, {
9
8
  map: map
10
9
  });
11
10
 
@@ -13,7 +13,7 @@ var $TypeError = TypeError;
13
13
 
14
14
  // `AsyncIterator.prototype.reduce` method
15
15
  // https://github.com/tc39/proposal-async-iterator-helpers
16
- $({ target: 'AsyncIterator', proto: true, real: true }, {
16
+ $({ target: 'AsyncIterator', proto: true, real: true, forced: true }, {
17
17
  reduce: function reduce(reducer /* , initialValue */) {
18
18
  anObject(this);
19
19
  aCallable(reducer);
@@ -4,7 +4,7 @@ var $some = require('../internals/async-iterator-iteration').some;
4
4
 
5
5
  // `AsyncIterator.prototype.some` method
6
6
  // https://github.com/tc39/proposal-async-iterator-helpers
7
- $({ target: 'AsyncIterator', proto: true, real: true }, {
7
+ $({ target: 'AsyncIterator', proto: true, real: true, forced: true }, {
8
8
  some: function some(predicate) {
9
9
  return $some(this, predicate);
10
10
  }
@@ -7,7 +7,6 @@ var notANaN = require('../internals/not-a-nan');
7
7
  var toPositiveInteger = require('../internals/to-positive-integer');
8
8
  var createAsyncIteratorProxy = require('../internals/async-iterator-create-proxy');
9
9
  var createIterResultObject = require('../internals/create-iter-result-object');
10
- var IS_PURE = require('../internals/is-pure');
11
10
 
12
11
  var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise) {
13
12
  var state = this;
@@ -37,7 +36,7 @@ var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise) {
37
36
 
38
37
  // `AsyncIterator.prototype.take` method
39
38
  // https://github.com/tc39/proposal-async-iterator-helpers
40
- $({ target: 'AsyncIterator', proto: true, real: true, forced: IS_PURE }, {
39
+ $({ target: 'AsyncIterator', proto: true, real: true, forced: true }, {
41
40
  take: function take(limit) {
42
41
  anObject(this);
43
42
  var remaining = toPositiveInteger(notANaN(+limit));
@@ -4,7 +4,7 @@ var $toArray = require('../internals/async-iterator-iteration').toArray;
4
4
 
5
5
  // `AsyncIterator.prototype.toArray` method
6
6
  // https://github.com/tc39/proposal-async-iterator-helpers
7
- $({ target: 'AsyncIterator', proto: true, real: true }, {
7
+ $({ target: 'AsyncIterator', proto: true, real: true, forced: true }, {
8
8
  toArray: function toArray() {
9
9
  return $toArray(this, undefined, []);
10
10
  }
@@ -1,31 +1,3 @@
1
1
  'use strict';
2
- var $ = require('../internals/export');
3
- var uncurryThis = require('../internals/function-uncurry-this');
4
-
5
- var pow = Math.pow;
6
-
7
- var EXP_MASK16 = 31; // 2 ** 5 - 1
8
- var SIGNIFICAND_MASK16 = 1023; // 2 ** 10 - 1
9
- var MIN_SUBNORMAL16 = pow(2, -24); // 2 ** -10 * 2 ** -14
10
- var SIGNIFICAND_DENOM16 = 0.0009765625; // 2 ** -10
11
-
12
- var unpackFloat16 = function (bytes) {
13
- var sign = bytes >>> 15;
14
- var exponent = bytes >>> 10 & EXP_MASK16;
15
- var significand = bytes & SIGNIFICAND_MASK16;
16
- if (exponent === EXP_MASK16) return significand === 0 ? (sign === 0 ? Infinity : -Infinity) : NaN;
17
- if (exponent === 0) return significand * (sign === 0 ? MIN_SUBNORMAL16 : -MIN_SUBNORMAL16);
18
- return pow(2, exponent - 15) * (sign === 0 ? 1 + significand * SIGNIFICAND_DENOM16 : -1 - significand * SIGNIFICAND_DENOM16);
19
- };
20
-
21
- // eslint-disable-next-line es/no-typed-arrays -- safe
22
- var getUint16 = uncurryThis(DataView.prototype.getUint16);
23
-
24
- // `DataView.prototype.getFloat16` method
25
- // https://github.com/tc39/proposal-float16array
26
- $({ target: 'DataView', proto: true }, {
27
- getFloat16: function getFloat16(byteOffset /* , littleEndian */) {
28
- var uint16 = getUint16(this, byteOffset, arguments.length > 1 ? arguments[1] : false);
29
- return unpackFloat16(uint16);
30
- }
31
- });
2
+ // TODO: Remove from `core-js@4`
3
+ require('../modules/es.data-view.get-float16');
@@ -1,54 +1,3 @@
1
1
  'use strict';
2
- var $ = require('../internals/export');
3
- var uncurryThis = require('../internals/function-uncurry-this');
4
- var aDataView = require('../internals/a-data-view');
5
- var toIndex = require('../internals/to-index');
6
- // TODO: Replace with module dependency in `core-js@4`
7
- var log2 = require('../internals/math-log2');
8
- var roundTiesToEven = require('../internals/math-round-ties-to-even');
9
-
10
- var pow = Math.pow;
11
-
12
- var MIN_INFINITY16 = 65520; // (2 - 2 ** -11) * 2 ** 15
13
- var MIN_NORMAL16 = 0.000061005353927612305; // (1 - 2 ** -11) * 2 ** -14
14
- var REC_MIN_SUBNORMAL16 = 16777216; // 2 ** 10 * 2 ** 14
15
- var REC_SIGNIFICAND_DENOM16 = 1024; // 2 ** 10;
16
-
17
- var packFloat16 = function (value) {
18
- // eslint-disable-next-line no-self-compare -- NaN check
19
- if (value !== value) return 0x7E00; // NaN
20
- if (value === 0) return (1 / value === -Infinity) << 15; // +0 or -0
21
-
22
- var neg = value < 0;
23
- if (neg) value = -value;
24
- if (value >= MIN_INFINITY16) return neg << 15 | 0x7C00; // Infinity
25
- if (value < MIN_NORMAL16) return neg << 15 | roundTiesToEven(value * REC_MIN_SUBNORMAL16); // subnormal
26
-
27
- // normal
28
- var exponent = log2(value) | 0;
29
- if (exponent === -15) {
30
- // we round from a value between 2 ** -15 * (1 + 1022/1024) (the largest subnormal) and 2 ** -14 * (1 + 0/1024) (the smallest normal)
31
- // to the latter (former impossible because of the subnormal check above)
32
- return neg << 15 | REC_SIGNIFICAND_DENOM16;
33
- }
34
- var significand = roundTiesToEven((value * pow(2, -exponent) - 1) * REC_SIGNIFICAND_DENOM16);
35
- if (significand === REC_SIGNIFICAND_DENOM16) {
36
- // we round from a value between 2 ** n * (1 + 1023/1024) and 2 ** (n + 1) * (1 + 0/1024) to the latter
37
- return neg << 15 | exponent + 16 << 10;
38
- }
39
- return neg << 15 | exponent + 15 << 10 | significand;
40
- };
41
-
42
- // eslint-disable-next-line es/no-typed-arrays -- safe
43
- var setUint16 = uncurryThis(DataView.prototype.setUint16);
44
-
45
- // `DataView.prototype.setFloat16` method
46
- // https://github.com/tc39/proposal-float16array
47
- $({ target: 'DataView', proto: true }, {
48
- setFloat16: function setFloat16(byteOffset, value /* , littleEndian */) {
49
- aDataView(this);
50
- var offset = toIndex(byteOffset);
51
- var bytes = packFloat16(+value);
52
- return setUint16(this, offset, bytes, arguments.length > 2 ? arguments[2] : false);
53
- }
54
- });
2
+ // TODO: Remove from `core-js@4`
3
+ require('../modules/es.data-view.set-float16');
@@ -4,11 +4,10 @@ var anObject = require('../internals/an-object');
4
4
  var AsyncFromSyncIterator = require('../internals/async-from-sync-iterator');
5
5
  var WrapAsyncIterator = require('../internals/async-iterator-wrap');
6
6
  var getIteratorDirect = require('../internals/get-iterator-direct');
7
- var IS_PURE = require('../internals/is-pure');
8
7
 
9
8
  // `Iterator.prototype.toAsync` method
10
9
  // https://github.com/tc39/proposal-async-iterator-helpers
11
- $({ target: 'Iterator', proto: true, real: true, forced: IS_PURE }, {
10
+ $({ target: 'Iterator', proto: true, real: true, forced: true }, {
12
11
  toAsync: function toAsync() {
13
12
  return new WrapAsyncIterator(getIteratorDirect(new AsyncFromSyncIterator(getIteratorDirect(anObject(this)))));
14
13
  }
@@ -3,7 +3,7 @@ var $ = require('../internals/export');
3
3
  var NATIVE_RAW_JSON = require('../internals/native-raw-json');
4
4
  var isRawJSON = require('../internals/is-raw-json');
5
5
 
6
- // `JSON.parse` method
6
+ // `JSON.isRawJSON` method
7
7
  // https://tc39.es/proposal-json-parse-with-source/#sec-json.israwjson
8
8
  // https://github.com/tc39/proposal-json-parse-with-source
9
9
  $({ target: 'JSON', stat: true, forced: !NATIVE_RAW_JSON }, {
@@ -32,8 +32,8 @@ var isWhitespace = function (it) {
32
32
  return it === ' ' || it === '\t' || it === '\n' || it === '\r';
33
33
  };
34
34
 
35
- // `JSON.parse` method
36
- // https://tc39.es/proposal-json-parse-with-source/#sec-json.israwjson
35
+ // `JSON.rawJSON` method
36
+ // https://tc39.es/proposal-json-parse-with-source/#sec-json.rawjson
37
37
  // https://github.com/tc39/proposal-json-parse-with-source
38
38
  $({ target: 'JSON', stat: true, forced: !NATIVE_RAW_JSON }, {
39
39
  rawJSON: function rawJSON(text) {
@@ -1,13 +1,21 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
+ var aNumber = require('../internals/a-number');
4
+ var notANaN = require('../internals/not-a-nan');
5
+ var sameValue = require('../internals/same-value');
3
6
 
4
- var min = Math.min;
5
- var max = Math.max;
7
+ var $RangeError = RangeError;
8
+ var $min = Math.min;
9
+ var $max = Math.max;
6
10
 
7
11
  // `Math.clamp` method
8
- // https://rwaldron.github.io/proposal-math-extensions/
12
+ // https://github.com/tc39/proposal-math-clamp
9
13
  $({ target: 'Math', stat: true, forced: true }, {
10
- clamp: function clamp(x, lower, upper) {
11
- return min(upper, max(lower, x));
14
+ clamp: function clamp(value, min, max) {
15
+ aNumber(value);
16
+ notANaN(aNumber(min));
17
+ notANaN(aNumber(max));
18
+ if ((sameValue(min, 0) && sameValue(max, -0)) || min > max) throw new $RangeError('`min` should be smaller than `max`');
19
+ return $min(max, $max(min, value));
12
20
  }
13
21
  });