core-js 3.39.0 → 3.40.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 (38) hide show
  1. package/LICENSE +1 -1
  2. package/actual/error/index.js +2 -0
  3. package/actual/error/is-error.js +6 -0
  4. package/features/error/is-error.js +2 -0
  5. package/full/error/is-error.js +4 -0
  6. package/full/index.js +1 -0
  7. package/internals/add-disposable-resource.js +7 -1
  8. package/internals/array-buffer-is-detached.js +5 -7
  9. package/internals/function-apply.js +1 -1
  10. package/internals/function-call.js +1 -1
  11. package/internals/function-uncurry-this.js +1 -0
  12. package/internals/iterator-create-proxy.js +6 -4
  13. package/internals/math-float-round.js +1 -5
  14. package/internals/math-log2.js +10 -0
  15. package/internals/math-round-ties-to-even.js +7 -0
  16. package/internals/math-scale.js +1 -1
  17. package/internals/native-raw-json.js +2 -0
  18. package/internals/object-assign.js +1 -0
  19. package/internals/set-method-accept-set-like.js +25 -2
  20. package/internals/shared-store.js +3 -3
  21. package/modules/es.math.log2.js +2 -6
  22. package/modules/es.set.difference.v2.js +5 -1
  23. package/modules/es.set.intersection.v2.js +4 -2
  24. package/modules/es.set.is-disjoint-from.v2.js +5 -1
  25. package/modules/es.set.is-subset-of.v2.js +5 -1
  26. package/modules/es.set.is-superset-of.v2.js +5 -1
  27. package/modules/esnext.array.from-async.js +1 -0
  28. package/modules/esnext.data-view.get-float16.js +17 -2
  29. package/modules/esnext.data-view.set-float16.js +37 -4
  30. package/modules/esnext.error.is-error.js +36 -0
  31. package/modules/esnext.iterator.concat.js +4 -3
  32. package/modules/esnext.math.f16round.js +10 -2
  33. package/modules/esnext.regexp.escape.js +1 -0
  34. package/modules/esnext.typed-array.to-spliced.js +1 -17
  35. package/package.json +1 -1
  36. package/proposals/is-error.js +3 -0
  37. package/stage/3.js +1 -0
  38. package/internals/math-f16round.js +0 -12
package/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014-2024 Denis Pushkarev
1
+ Copyright (c) 2014-2025 Denis Pushkarev
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
@@ -1,4 +1,6 @@
1
1
  'use strict';
2
2
  var parent = require('../../stable/error');
3
+ require('../../modules/es.object.create');
4
+ require('../../modules/esnext.error.is-error');
3
5
 
4
6
  module.exports = parent;
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+ require('../../modules/es.object.create');
3
+ require('../../modules/esnext.error.is-error');
4
+ var path = require('../../internals/path');
5
+
6
+ module.exports = path.Error.isError;
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+ module.exports = require('../../full/error/is-error');
@@ -0,0 +1,4 @@
1
+ 'use strict';
2
+ var parent = require('../../actual/error/is-error');
3
+
4
+ module.exports = parent;
package/full/index.js CHANGED
@@ -316,6 +316,7 @@ require('../modules/esnext.data-view.get-uint8-clamped');
316
316
  require('../modules/esnext.data-view.set-float16');
317
317
  require('../modules/esnext.data-view.set-uint8-clamped');
318
318
  require('../modules/esnext.disposable-stack.constructor');
319
+ require('../modules/esnext.error.is-error');
319
320
  require('../modules/esnext.function.demethodize');
320
321
  require('../modules/esnext.function.is-callable');
321
322
  require('../modules/esnext.function.is-constructor');
@@ -1,4 +1,5 @@
1
1
  'use strict';
2
+ var getBuiltIn = require('../internals/get-built-in');
2
3
  var call = require('../internals/function-call');
3
4
  var uncurryThis = require('../internals/function-uncurry-this');
4
5
  var bind = require('../internals/function-bind-context');
@@ -22,7 +23,12 @@ var getDisposeMethod = function (V, hint) {
22
23
  method = getMethod(V, DISPOSE);
23
24
  if (method === undefined) return method;
24
25
  return function () {
25
- call(method, this);
26
+ var O = this;
27
+ var Promise = getBuiltIn('Promise');
28
+ return new Promise(function (resolve) {
29
+ call(method, O);
30
+ resolve(undefined);
31
+ });
26
32
  };
27
33
  } return getMethod(V, DISPOSE);
28
34
  };
@@ -1,17 +1,15 @@
1
1
  'use strict';
2
2
  var globalThis = require('../internals/global-this');
3
- var uncurryThis = require('../internals/function-uncurry-this-clause');
3
+ var NATIVE_ARRAY_BUFFER = require('../internals/array-buffer-basic-detection');
4
4
  var arrayBufferByteLength = require('../internals/array-buffer-byte-length');
5
5
 
6
- var ArrayBuffer = globalThis.ArrayBuffer;
7
- var ArrayBufferPrototype = ArrayBuffer && ArrayBuffer.prototype;
8
- var slice = ArrayBufferPrototype && uncurryThis(ArrayBufferPrototype.slice);
6
+ var DataView = globalThis.DataView;
9
7
 
10
8
  module.exports = function (O) {
11
- if (arrayBufferByteLength(O) !== 0) return false;
12
- if (!slice) return false;
9
+ if (!NATIVE_ARRAY_BUFFER || arrayBufferByteLength(O) !== 0) return false;
13
10
  try {
14
- slice(O, 0, 0);
11
+ // eslint-disable-next-line no-new -- thrower
12
+ new DataView(O);
15
13
  return false;
16
14
  } catch (error) {
17
15
  return true;
@@ -5,7 +5,7 @@ var FunctionPrototype = Function.prototype;
5
5
  var apply = FunctionPrototype.apply;
6
6
  var call = FunctionPrototype.call;
7
7
 
8
- // eslint-disable-next-line es/no-reflect -- safe
8
+ // eslint-disable-next-line es/no-function-prototype-bind, es/no-reflect -- safe
9
9
  module.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () {
10
10
  return call.apply(apply, arguments);
11
11
  });
@@ -2,7 +2,7 @@
2
2
  var NATIVE_BIND = require('../internals/function-bind-native');
3
3
 
4
4
  var call = Function.prototype.call;
5
-
5
+ // eslint-disable-next-line es/no-function-prototype-bind -- safe
6
6
  module.exports = NATIVE_BIND ? call.bind(call) : function () {
7
7
  return call.apply(call, arguments);
8
8
  };
@@ -3,6 +3,7 @@ var NATIVE_BIND = require('../internals/function-bind-native');
3
3
 
4
4
  var FunctionPrototype = Function.prototype;
5
5
  var call = FunctionPrototype.call;
6
+ // eslint-disable-next-line es/no-function-prototype-bind -- safe
6
7
  var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call);
7
8
 
8
9
  module.exports = NATIVE_BIND ? uncurryThisWithBind : function (fn) {
@@ -22,12 +22,13 @@ var createIteratorProxyPrototype = function (IS_ITERATOR) {
22
22
  next: function next() {
23
23
  var state = getInternalState(this);
24
24
  // for simplification:
25
- // for `%WrapForValidIteratorPrototype%.next` our `nextHandler` returns `IterResultObject`
25
+ // for `%WrapForValidIteratorPrototype%.next` or with `state.returnHandlerResult` our `nextHandler` returns `IterResultObject`
26
26
  // for `%IteratorHelperPrototype%.next` - just a value
27
27
  if (IS_ITERATOR) return state.nextHandler();
28
+ if (state.done) return createIterResultObject(undefined, true);
28
29
  try {
29
- var result = state.done ? undefined : state.nextHandler();
30
- return createIterResultObject(result, state.done);
30
+ var result = state.nextHandler();
31
+ return state.returnHandlerResult ? result : createIterResultObject(result, state.done);
31
32
  } catch (error) {
32
33
  state.done = true;
33
34
  throw error;
@@ -57,13 +58,14 @@ var IteratorHelperPrototype = createIteratorProxyPrototype(false);
57
58
 
58
59
  createNonEnumerableProperty(IteratorHelperPrototype, TO_STRING_TAG, 'Iterator Helper');
59
60
 
60
- module.exports = function (nextHandler, IS_ITERATOR) {
61
+ module.exports = function (nextHandler, IS_ITERATOR, RETURN_HANDLER_RESULT) {
61
62
  var IteratorProxy = function Iterator(record, state) {
62
63
  if (state) {
63
64
  state.iterator = record.iterator;
64
65
  state.next = record.next;
65
66
  } else state = record;
66
67
  state.type = IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER;
68
+ state.returnHandlerResult = !!RETURN_HANDLER_RESULT;
67
69
  state.nextHandler = nextHandler;
68
70
  state.counter = 0;
69
71
  state.done = false;
@@ -1,14 +1,10 @@
1
1
  'use strict';
2
2
  var sign = require('../internals/math-sign');
3
+ var roundTiesToEven = require('../internals/math-round-ties-to-even');
3
4
 
4
5
  var abs = Math.abs;
5
6
 
6
7
  var EPSILON = 2.220446049250313e-16; // Number.EPSILON
7
- var INVERSE_EPSILON = 1 / EPSILON;
8
-
9
- var roundTiesToEven = function (n) {
10
- return n + INVERSE_EPSILON - INVERSE_EPSILON;
11
- };
12
8
 
13
9
  module.exports = function (x, FLOAT_EPSILON, FLOAT_MAX_VALUE, FLOAT_MIN_VALUE) {
14
10
  var n = +x;
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+ var log = Math.log;
3
+ var LN2 = Math.LN2;
4
+
5
+ // `Math.log2` method
6
+ // https://tc39.es/ecma262/#sec-math.log2
7
+ // eslint-disable-next-line es/no-math-log2 -- safe
8
+ module.exports = Math.log2 || function log2(x) {
9
+ return log(x) / LN2;
10
+ };
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+ var EPSILON = 2.220446049250313e-16; // Number.EPSILON
3
+ var INVERSE_EPSILON = 1 / EPSILON;
4
+
5
+ module.exports = function (n) {
6
+ return n + INVERSE_EPSILON - INVERSE_EPSILON;
7
+ };
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
  // `Math.scale` method implementation
3
3
  // https://rwaldron.github.io/proposal-math-extensions/
4
- module.exports = Math.scale || function scale(x, inLow, inHigh, outLow, outHigh) {
4
+ module.exports = function scale(x, inLow, inHigh, outLow, outHigh) {
5
5
  var nx = +x;
6
6
  var nInLow = +inLow;
7
7
  var nInHigh = +inHigh;
@@ -4,6 +4,8 @@ var fails = require('../internals/fails');
4
4
 
5
5
  module.exports = !fails(function () {
6
6
  var unsafeInt = '9007199254740993';
7
+ // eslint-disable-next-line es/no-nonstandard-json-properties -- feature detection
7
8
  var raw = JSON.rawJSON(unsafeInt);
9
+ // eslint-disable-next-line es/no-nonstandard-json-properties -- feature detection
8
10
  return !JSON.isRawJSON(raw) || JSON.stringify(raw) !== unsafeInt;
9
11
  });
@@ -35,6 +35,7 @@ module.exports = !$assign || fails(function () {
35
35
  var symbol = Symbol('assign detection');
36
36
  var alphabet = 'abcdefghijklmnopqrst';
37
37
  A[symbol] = 7;
38
+ // eslint-disable-next-line es/no-array-prototype-foreach -- safe
38
39
  alphabet.split('').forEach(function (chr) { B[chr] = chr; });
39
40
  return $assign({}, A)[symbol] !== 7 || objectKeys($assign({}, B)).join('') !== alphabet;
40
41
  }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
@@ -17,7 +17,19 @@ var createSetLike = function (size) {
17
17
  };
18
18
  };
19
19
 
20
- module.exports = function (name) {
20
+ var createSetLikeWithInfinitySize = function (size) {
21
+ return {
22
+ size: size,
23
+ has: function () {
24
+ return true;
25
+ },
26
+ keys: function () {
27
+ throw new Error('e');
28
+ }
29
+ };
30
+ };
31
+
32
+ module.exports = function (name, callback) {
21
33
  var Set = getBuiltIn('Set');
22
34
  try {
23
35
  new Set()[name](createSetLike(0));
@@ -27,7 +39,18 @@ module.exports = function (name) {
27
39
  new Set()[name](createSetLike(-1));
28
40
  return false;
29
41
  } catch (error2) {
30
- return true;
42
+ if (!callback) return true;
43
+ // early V8 implementation bug
44
+ // https://issues.chromium.org/issues/351332634
45
+ try {
46
+ new Set()[name](createSetLikeWithInfinitySize(-Infinity));
47
+ return false;
48
+ } catch (error) {
49
+ var set = new Set();
50
+ set.add(1);
51
+ set.add(2);
52
+ return callback(set[name](createSetLikeWithInfinitySize(Infinity)));
53
+ }
31
54
  }
32
55
  } catch (error) {
33
56
  return false;
@@ -7,9 +7,9 @@ var SHARED = '__core-js_shared__';
7
7
  var store = module.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {});
8
8
 
9
9
  (store.versions || (store.versions = [])).push({
10
- version: '3.39.0',
10
+ version: '3.40.0',
11
11
  mode: IS_PURE ? 'pure' : 'global',
12
- copyright: '© 2014-2024 Denis Pushkarev (zloirock.ru)',
13
- license: 'https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE',
12
+ copyright: '© 2014-2025 Denis Pushkarev (zloirock.ru)',
13
+ license: 'https://github.com/zloirock/core-js/blob/v3.40.0/LICENSE',
14
14
  source: 'https://github.com/zloirock/core-js'
15
15
  });
@@ -1,13 +1,9 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
-
4
- var log = Math.log;
5
- var LN2 = Math.LN2;
3
+ var log2 = require('../internals/math-log2');
6
4
 
7
5
  // `Math.log2` method
8
6
  // https://tc39.es/ecma262/#sec-math.log2
9
7
  $({ target: 'Math', stat: true }, {
10
- log2: function log2(x) {
11
- return log(x) / LN2;
12
- }
8
+ log2: log2
13
9
  });
@@ -3,8 +3,12 @@ var $ = require('../internals/export');
3
3
  var difference = require('../internals/set-difference');
4
4
  var setMethodAcceptSetLike = require('../internals/set-method-accept-set-like');
5
5
 
6
+ var INCORRECT = !setMethodAcceptSetLike('difference', function (result) {
7
+ return result.size === 0;
8
+ });
9
+
6
10
  // `Set.prototype.difference` method
7
11
  // https://tc39.es/ecma262/#sec-set.prototype.difference
8
- $({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike('difference') }, {
12
+ $({ target: 'Set', proto: true, real: true, forced: INCORRECT }, {
9
13
  difference: difference
10
14
  });
@@ -4,8 +4,10 @@ var fails = require('../internals/fails');
4
4
  var intersection = require('../internals/set-intersection');
5
5
  var setMethodAcceptSetLike = require('../internals/set-method-accept-set-like');
6
6
 
7
- var INCORRECT = !setMethodAcceptSetLike('intersection') || fails(function () {
8
- // eslint-disable-next-line es/no-array-from, es/no-set -- testing
7
+ var INCORRECT = !setMethodAcceptSetLike('intersection', function (result) {
8
+ return result.size === 2 && result.has(1) && result.has(2);
9
+ }) || fails(function () {
10
+ // eslint-disable-next-line es/no-array-from, es/no-set, es/no-set-prototype-intersection -- testing
9
11
  return String(Array.from(new Set([1, 2, 3]).intersection(new Set([3, 2])))) !== '3,2';
10
12
  });
11
13
 
@@ -3,8 +3,12 @@ var $ = require('../internals/export');
3
3
  var isDisjointFrom = require('../internals/set-is-disjoint-from');
4
4
  var setMethodAcceptSetLike = require('../internals/set-method-accept-set-like');
5
5
 
6
+ var INCORRECT = !setMethodAcceptSetLike('isDisjointFrom', function (result) {
7
+ return !result;
8
+ });
9
+
6
10
  // `Set.prototype.isDisjointFrom` method
7
11
  // https://tc39.es/ecma262/#sec-set.prototype.isdisjointfrom
8
- $({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike('isDisjointFrom') }, {
12
+ $({ target: 'Set', proto: true, real: true, forced: INCORRECT }, {
9
13
  isDisjointFrom: isDisjointFrom
10
14
  });
@@ -3,8 +3,12 @@ var $ = require('../internals/export');
3
3
  var isSubsetOf = require('../internals/set-is-subset-of');
4
4
  var setMethodAcceptSetLike = require('../internals/set-method-accept-set-like');
5
5
 
6
+ var INCORRECT = !setMethodAcceptSetLike('isSubsetOf', function (result) {
7
+ return result;
8
+ });
9
+
6
10
  // `Set.prototype.isSubsetOf` method
7
11
  // https://tc39.es/ecma262/#sec-set.prototype.issubsetof
8
- $({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike('isSubsetOf') }, {
12
+ $({ target: 'Set', proto: true, real: true, forced: INCORRECT }, {
9
13
  isSubsetOf: isSubsetOf
10
14
  });
@@ -3,8 +3,12 @@ var $ = require('../internals/export');
3
3
  var isSupersetOf = require('../internals/set-is-superset-of');
4
4
  var setMethodAcceptSetLike = require('../internals/set-method-accept-set-like');
5
5
 
6
+ var INCORRECT = !setMethodAcceptSetLike('isSupersetOf', function (result) {
7
+ return !result;
8
+ });
9
+
6
10
  // `Set.prototype.isSupersetOf` method
7
11
  // https://tc39.es/ecma262/#sec-set.prototype.issupersetof
8
- $({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike('isSupersetOf') }, {
12
+ $({ target: 'Set', proto: true, real: true, forced: INCORRECT }, {
9
13
  isSupersetOf: isSupersetOf
10
14
  });
@@ -3,6 +3,7 @@ var $ = require('../internals/export');
3
3
  var fromAsync = require('../internals/array-from-async');
4
4
  var fails = require('../internals/fails');
5
5
 
6
+ // eslint-disable-next-line es/no-nonstandard-array-properties -- safe
6
7
  var nativeFromAsync = Array.fromAsync;
7
8
  // https://bugs.webkit.org/show_bug.cgi?id=271703
8
9
  var INCORRECT_CONSTRUCTURING = !nativeFromAsync || fails(function () {
@@ -1,7 +1,22 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
3
  var uncurryThis = require('../internals/function-uncurry-this');
4
- var unpackIEEE754 = require('../internals/ieee754').unpack;
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
+ };
5
20
 
6
21
  // eslint-disable-next-line es/no-typed-arrays -- safe
7
22
  var getUint16 = uncurryThis(DataView.prototype.getUint16);
@@ -11,6 +26,6 @@ var getUint16 = uncurryThis(DataView.prototype.getUint16);
11
26
  $({ target: 'DataView', proto: true }, {
12
27
  getFloat16: function getFloat16(byteOffset /* , littleEndian */) {
13
28
  var uint16 = getUint16(this, byteOffset, arguments.length > 1 ? arguments[1] : false);
14
- return unpackIEEE754([uint16 & 0xFF, uint16 >> 8 & 0xFF], 10);
29
+ return unpackFloat16(uint16);
15
30
  }
16
31
  });
@@ -3,8 +3,41 @@ var $ = require('../internals/export');
3
3
  var uncurryThis = require('../internals/function-uncurry-this');
4
4
  var aDataView = require('../internals/a-data-view');
5
5
  var toIndex = require('../internals/to-index');
6
- var packIEEE754 = require('../internals/ieee754').pack;
7
- var f16round = require('../internals/math-f16round');
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
+ };
8
41
 
9
42
  // eslint-disable-next-line es/no-typed-arrays -- safe
10
43
  var setUint16 = uncurryThis(DataView.prototype.setUint16);
@@ -15,7 +48,7 @@ $({ target: 'DataView', proto: true }, {
15
48
  setFloat16: function setFloat16(byteOffset, value /* , littleEndian */) {
16
49
  aDataView(this);
17
50
  var offset = toIndex(byteOffset);
18
- var bytes = packIEEE754(f16round(value), 10, 2);
19
- return setUint16(this, offset, bytes[1] << 8 | bytes[0], arguments.length > 2 ? arguments[2] : false);
51
+ var bytes = packFloat16(+value);
52
+ return setUint16(this, offset, bytes, arguments.length > 2 ? arguments[2] : false);
20
53
  }
21
54
  });
@@ -0,0 +1,36 @@
1
+ 'use strict';
2
+ var $ = require('../internals/export');
3
+ var getBuiltIn = require('../internals/get-built-in');
4
+ var isObject = require('../internals/is-object');
5
+ var classof = require('../internals/classof');
6
+ var fails = require('../internals/fails');
7
+
8
+ var ERROR = 'Error';
9
+ var DOM_EXCEPTION = 'DOMException';
10
+ // eslint-disable-next-line es/no-object-setprototypeof, no-proto -- safe
11
+ var PROTOTYPE_SETTING_AVAILABLE = Object.setPrototypeOf || ({}).__proto__;
12
+
13
+ var DOMException = getBuiltIn(DOM_EXCEPTION);
14
+ var $Error = Error;
15
+ var $isError = $Error.isError;
16
+
17
+ var FORCED = !$isError || !PROTOTYPE_SETTING_AVAILABLE || fails(function () {
18
+ // Bun, isNativeError-based implementations, some buggy structuredClone-based implementations, etc.
19
+ // https://github.com/oven-sh/bun/issues/15821
20
+ return (DOMException && !$isError(new DOMException(DOM_EXCEPTION))) ||
21
+ // structuredClone-based implementations
22
+ // eslint-disable-next-line es/no-error-cause -- detection
23
+ !$isError(new $Error(ERROR, { cause: function () { /* empty */ } })) ||
24
+ // instanceof-based and FF Error#stack-based implementations
25
+ $isError(getBuiltIn('Object', 'create')($Error.prototype));
26
+ });
27
+
28
+ // `Error.isError` method
29
+ // https://github.com/tc39/proposal-is-error
30
+ $({ target: 'Error', stat: true, sham: true, forced: FORCED }, {
31
+ isError: function isError(arg) {
32
+ if (!isObject(arg)) return false;
33
+ var tag = classof(arg);
34
+ return tag === ERROR || tag === DOM_EXCEPTION;
35
+ }
36
+ });
@@ -5,6 +5,7 @@ var aCallable = require('../internals/a-callable');
5
5
  var anObject = require('../internals/an-object');
6
6
  var getIteratorMethod = require('../internals/get-iterator-method');
7
7
  var createIteratorProxy = require('../internals/iterator-create-proxy');
8
+ var createIterResultObject = require('../internals/create-iter-result-object');
8
9
 
9
10
  var $Array = Array;
10
11
 
@@ -16,7 +17,7 @@ var IteratorProxy = createIteratorProxy(function () {
16
17
  var iterables = this.iterables;
17
18
  if (iterableIndex >= iterables.length) {
18
19
  this.done = true;
19
- return;
20
+ return createIterResultObject(undefined, true);
20
21
  }
21
22
  var entry = iterables[iterableIndex];
22
23
  this.iterables[iterableIndex] = null;
@@ -29,9 +30,9 @@ var IteratorProxy = createIteratorProxy(function () {
29
30
  this.next = null;
30
31
  continue;
31
32
  }
32
- return result.value;
33
+ return result;
33
34
  }
34
- });
35
+ }, false, true);
35
36
 
36
37
  // `Iterator.concat` method
37
38
  // https://github.com/tc39/proposal-iterator-sequencing
@@ -1,7 +1,15 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
- var f16round = require('../internals/math-f16round');
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;
4
8
 
5
9
  // `Math.f16round` method
6
10
  // https://github.com/tc39/proposal-float16array
7
- $({ target: 'Math', stat: true }, { f16round: 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
+ });
@@ -7,6 +7,7 @@ var padStart = require('../internals/string-pad').start;
7
7
  var WHITESPACES = require('../internals/whitespaces');
8
8
 
9
9
  var $Array = Array;
10
+ // eslint-disable-next-line es/no-nonstandard-regexp-properties -- safe
10
11
  var $escape = RegExp.escape;
11
12
  var charAt = uncurryThis(''.charAt);
12
13
  var charCodeAt = uncurryThis(''.charCodeAt);
@@ -6,7 +6,6 @@ var isBigIntArray = require('../internals/is-big-int-array');
6
6
  var toAbsoluteIndex = require('../internals/to-absolute-index');
7
7
  var toBigInt = require('../internals/to-big-int');
8
8
  var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
9
- var fails = require('../internals/fails');
10
9
 
11
10
  var aTypedArray = ArrayBufferViewCore.aTypedArray;
12
11
  var getTypedArrayConstructor = ArrayBufferViewCore.getTypedArrayConstructor;
@@ -14,21 +13,6 @@ var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
14
13
  var max = Math.max;
15
14
  var min = Math.min;
16
15
 
17
- // some early implementations, like WebKit, does not follow the final semantic
18
- var PROPER_ORDER = !fails(function () {
19
- // eslint-disable-next-line es/no-typed-arrays -- required for testing
20
- var array = new Int8Array([1]);
21
-
22
- var spliced = array.toSpliced(1, 0, {
23
- valueOf: function () {
24
- array[0] = 2;
25
- return 3;
26
- }
27
- });
28
-
29
- return spliced[0] !== 2 || spliced[1] !== 3;
30
- });
31
-
32
16
  // `%TypedArray%.prototype.toSpliced` method
33
17
  // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toSpliced
34
18
  exportTypedArrayMethod('toSpliced', function toSpliced(start, deleteCount /* , ...items */) {
@@ -65,4 +49,4 @@ exportTypedArrayMethod('toSpliced', function toSpliced(start, deleteCount /* , .
65
49
  for (; k < newLen; k++) A[k] = O[k + actualDeleteCount - insertCount];
66
50
 
67
51
  return A;
68
- }, !PROPER_ORDER);
52
+ }, true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "core-js",
3
- "version": "3.39.0",
3
+ "version": "3.40.0",
4
4
  "type": "commonjs",
5
5
  "description": "Standard library",
6
6
  "keywords": [
@@ -0,0 +1,3 @@
1
+ 'use strict';
2
+ // https://github.com/tc39/proposal-is-error
3
+ require('../modules/esnext.error.is-error');
package/stage/3.js CHANGED
@@ -6,6 +6,7 @@ require('../proposals/array-from-async-stage-2');
6
6
  require('../proposals/decorator-metadata-v2');
7
7
  require('../proposals/explicit-resource-management');
8
8
  require('../proposals/float16');
9
+ require('../proposals/is-error');
9
10
  require('../proposals/json-parse-with-source');
10
11
  require('../proposals/math-sum');
11
12
  require('../proposals/regexp-escaping');
@@ -1,12 +0,0 @@
1
- 'use strict';
2
- var floatRound = require('../internals/math-float-round');
3
-
4
- var FLOAT16_EPSILON = 0.0009765625;
5
- var FLOAT16_MAX_VALUE = 65504;
6
- var FLOAT16_MIN_VALUE = 6.103515625e-05;
7
-
8
- // `Math.f16round` method implementation
9
- // https://github.com/tc39/proposal-float16array
10
- module.exports = Math.f16round || function f16round(x) {
11
- return floatRound(x, FLOAT16_EPSILON, FLOAT16_MAX_VALUE, FLOAT16_MIN_VALUE);
12
- };