Comparing version 3.39.0 to 3.40.0
'use strict'; | ||
var parent = require('../../stable/error'); | ||
require('../../modules/es.object.create'); | ||
require('../../modules/esnext.error.is-error'); | ||
module.exports = parent; |
@@ -319,2 +319,3 @@ 'use strict'; | ||
require('../modules/esnext.disposable-stack.constructor'); | ||
require('../modules/esnext.error.is-error'); | ||
require('../modules/esnext.function.demethodize'); | ||
@@ -321,0 +322,0 @@ require('../modules/esnext.function.is-callable'); |
'use strict'; | ||
var getBuiltIn = require('../internals/get-built-in'); | ||
var call = require('../internals/function-call'); | ||
@@ -25,3 +26,8 @@ var uncurryThis = require('../internals/function-uncurry-this'); | ||
return function () { | ||
call(method, this); | ||
var O = this; | ||
var Promise = getBuiltIn('Promise'); | ||
return new Promise(function (resolve) { | ||
call(method, O); | ||
resolve(undefined); | ||
}); | ||
}; | ||
@@ -28,0 +34,0 @@ } return getMethod(V, DISPOSE); |
'use strict'; | ||
var globalThis = require('../internals/global-this'); | ||
var uncurryThis = require('../internals/function-uncurry-this-clause'); | ||
var NATIVE_ARRAY_BUFFER = require('../internals/array-buffer-basic-detection'); | ||
var arrayBufferByteLength = require('../internals/array-buffer-byte-length'); | ||
var ArrayBuffer = globalThis.ArrayBuffer; | ||
var ArrayBufferPrototype = ArrayBuffer && ArrayBuffer.prototype; | ||
var slice = ArrayBufferPrototype && uncurryThis(ArrayBufferPrototype.slice); | ||
var DataView = globalThis.DataView; | ||
module.exports = function (O) { | ||
if (arrayBufferByteLength(O) !== 0) return false; | ||
if (!slice) return false; | ||
if (!NATIVE_ARRAY_BUFFER || arrayBufferByteLength(O) !== 0) return false; | ||
try { | ||
slice(O, 0, 0); | ||
// eslint-disable-next-line no-new -- thrower | ||
new DataView(O); | ||
return false; | ||
@@ -16,0 +14,0 @@ } catch (error) { |
@@ -8,5 +8,5 @@ 'use strict'; | ||
// eslint-disable-next-line es/no-reflect -- safe | ||
// eslint-disable-next-line es/no-function-prototype-bind, es/no-reflect -- safe | ||
module.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () { | ||
return call.apply(apply, arguments); | ||
}); |
@@ -5,5 +5,5 @@ 'use strict'; | ||
var call = Function.prototype.call; | ||
// eslint-disable-next-line es/no-function-prototype-bind -- safe | ||
module.exports = NATIVE_BIND ? call.bind(call) : function () { | ||
return call.apply(call, arguments); | ||
}; |
@@ -6,2 +6,3 @@ 'use strict'; | ||
var call = FunctionPrototype.call; | ||
// eslint-disable-next-line es/no-function-prototype-bind -- safe | ||
var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call); | ||
@@ -8,0 +9,0 @@ |
@@ -25,8 +25,9 @@ 'use strict'; | ||
// for simplification: | ||
// for `%WrapForValidIteratorPrototype%.next` our `nextHandler` returns `IterResultObject` | ||
// for `%WrapForValidIteratorPrototype%.next` or with `state.returnHandlerResult` our `nextHandler` returns `IterResultObject` | ||
// for `%IteratorHelperPrototype%.next` - just a value | ||
if (IS_ITERATOR) return state.nextHandler(); | ||
if (state.done) return createIterResultObject(undefined, true); | ||
try { | ||
var result = state.done ? undefined : state.nextHandler(); | ||
return createIterResultObject(result, state.done); | ||
var result = state.nextHandler(); | ||
return state.returnHandlerResult ? result : createIterResultObject(result, state.done); | ||
} catch (error) { | ||
@@ -61,3 +62,3 @@ state.done = true; | ||
module.exports = function (nextHandler, IS_ITERATOR) { | ||
module.exports = function (nextHandler, IS_ITERATOR, RETURN_HANDLER_RESULT) { | ||
var IteratorProxy = function Iterator(record, state) { | ||
@@ -69,2 +70,3 @@ if (state) { | ||
state.type = IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER; | ||
state.returnHandlerResult = !!RETURN_HANDLER_RESULT; | ||
state.nextHandler = nextHandler; | ||
@@ -71,0 +73,0 @@ state.counter = 0; |
'use strict'; | ||
var sign = require('../internals/math-sign'); | ||
var roundTiesToEven = require('../internals/math-round-ties-to-even'); | ||
@@ -7,8 +8,3 @@ var abs = Math.abs; | ||
var EPSILON = 2.220446049250313e-16; // Number.EPSILON | ||
var INVERSE_EPSILON = 1 / EPSILON; | ||
var roundTiesToEven = function (n) { | ||
return n + INVERSE_EPSILON - INVERSE_EPSILON; | ||
}; | ||
module.exports = function (x, FLOAT_EPSILON, FLOAT_MAX_VALUE, FLOAT_MIN_VALUE) { | ||
@@ -15,0 +11,0 @@ var n = +x; |
'use strict'; | ||
// `Math.scale` method implementation | ||
// https://rwaldron.github.io/proposal-math-extensions/ | ||
module.exports = Math.scale || function scale(x, inLow, inHigh, outLow, outHigh) { | ||
module.exports = function scale(x, inLow, inHigh, outLow, outHigh) { | ||
var nx = +x; | ||
@@ -6,0 +6,0 @@ var nInLow = +inLow; |
@@ -7,4 +7,6 @@ 'use strict'; | ||
var unsafeInt = '9007199254740993'; | ||
// eslint-disable-next-line es/no-nonstandard-json-properties -- feature detection | ||
var raw = JSON.rawJSON(unsafeInt); | ||
// eslint-disable-next-line es/no-nonstandard-json-properties -- feature detection | ||
return !JSON.isRawJSON(raw) || JSON.stringify(raw) !== unsafeInt; | ||
}); |
@@ -38,2 +38,3 @@ 'use strict'; | ||
A[symbol] = 7; | ||
// eslint-disable-next-line es/no-array-prototype-foreach -- safe | ||
alphabet.split('').forEach(function (chr) { B[chr] = chr; }); | ||
@@ -40,0 +41,0 @@ return $assign({}, A)[symbol] !== 7 || objectKeys($assign({}, B)).join('') !== alphabet; |
@@ -20,3 +20,15 @@ 'use strict'; | ||
module.exports = function (name) { | ||
var createSetLikeWithInfinitySize = function (size) { | ||
return { | ||
size: size, | ||
has: function () { | ||
return true; | ||
}, | ||
keys: function () { | ||
throw new Error('e'); | ||
} | ||
}; | ||
}; | ||
module.exports = function (name, callback) { | ||
var Set = getBuiltIn('Set'); | ||
@@ -31,3 +43,14 @@ try { | ||
} catch (error2) { | ||
return true; | ||
if (!callback) return true; | ||
// early V8 implementation bug | ||
// https://issues.chromium.org/issues/351332634 | ||
try { | ||
new Set()[name](createSetLikeWithInfinitySize(-Infinity)); | ||
return false; | ||
} catch (error) { | ||
var set = new Set(); | ||
set.add(1); | ||
set.add(2); | ||
return callback(set[name](createSetLikeWithInfinitySize(Infinity))); | ||
} | ||
} | ||
@@ -34,0 +57,0 @@ } catch (error) { |
@@ -10,7 +10,7 @@ 'use strict'; | ||
(store.versions || (store.versions = [])).push({ | ||
version: '3.39.0', | ||
version: '3.40.0', | ||
mode: IS_PURE ? 'pure' : 'global', | ||
copyright: '© 2014-2024 Denis Pushkarev (zloirock.ru)', | ||
license: 'https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE', | ||
copyright: '© 2014-2025 Denis Pushkarev (zloirock.ru)', | ||
license: 'https://github.com/zloirock/core-js/blob/v3.40.0/LICENSE', | ||
source: 'https://github.com/zloirock/core-js' | ||
}); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var log2 = require('../internals/math-log2'); | ||
var log = Math.log; | ||
var LN2 = Math.LN2; | ||
// `Math.log2` method | ||
// https://tc39.es/ecma262/#sec-math.log2 | ||
$({ target: 'Math', stat: true }, { | ||
log2: function log2(x) { | ||
return log(x) / LN2; | ||
} | ||
log2: log2 | ||
}); |
@@ -6,6 +6,10 @@ 'use strict'; | ||
var INCORRECT = !setMethodAcceptSetLike('difference', function (result) { | ||
return result.size === 0; | ||
}); | ||
// `Set.prototype.difference` method | ||
// https://tc39.es/ecma262/#sec-set.prototype.difference | ||
$({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike('difference') }, { | ||
$({ target: 'Set', proto: true, real: true, forced: INCORRECT }, { | ||
difference: difference | ||
}); |
@@ -7,4 +7,6 @@ 'use strict'; | ||
var INCORRECT = !setMethodAcceptSetLike('intersection') || fails(function () { | ||
// eslint-disable-next-line es/no-array-from, es/no-set -- testing | ||
var INCORRECT = !setMethodAcceptSetLike('intersection', function (result) { | ||
return result.size === 2 && result.has(1) && result.has(2); | ||
}) || fails(function () { | ||
// eslint-disable-next-line es/no-array-from, es/no-set, es/no-set-prototype-intersection -- testing | ||
return String(Array.from(new Set([1, 2, 3]).intersection(new Set([3, 2])))) !== '3,2'; | ||
@@ -11,0 +13,0 @@ }); |
@@ -6,6 +6,10 @@ 'use strict'; | ||
var INCORRECT = !setMethodAcceptSetLike('isDisjointFrom', function (result) { | ||
return !result; | ||
}); | ||
// `Set.prototype.isDisjointFrom` method | ||
// https://tc39.es/ecma262/#sec-set.prototype.isdisjointfrom | ||
$({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike('isDisjointFrom') }, { | ||
$({ target: 'Set', proto: true, real: true, forced: INCORRECT }, { | ||
isDisjointFrom: isDisjointFrom | ||
}); |
@@ -6,6 +6,10 @@ 'use strict'; | ||
var INCORRECT = !setMethodAcceptSetLike('isSubsetOf', function (result) { | ||
return result; | ||
}); | ||
// `Set.prototype.isSubsetOf` method | ||
// https://tc39.es/ecma262/#sec-set.prototype.issubsetof | ||
$({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike('isSubsetOf') }, { | ||
$({ target: 'Set', proto: true, real: true, forced: INCORRECT }, { | ||
isSubsetOf: isSubsetOf | ||
}); |
@@ -6,6 +6,10 @@ 'use strict'; | ||
var INCORRECT = !setMethodAcceptSetLike('isSupersetOf', function (result) { | ||
return !result; | ||
}); | ||
// `Set.prototype.isSupersetOf` method | ||
// https://tc39.es/ecma262/#sec-set.prototype.issupersetof | ||
$({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike('isSupersetOf') }, { | ||
$({ target: 'Set', proto: true, real: true, forced: INCORRECT }, { | ||
isSupersetOf: isSupersetOf | ||
}); |
@@ -6,2 +6,3 @@ 'use strict'; | ||
// eslint-disable-next-line es/no-nonstandard-array-properties -- safe | ||
var nativeFromAsync = Array.fromAsync; | ||
@@ -8,0 +9,0 @@ // https://bugs.webkit.org/show_bug.cgi?id=271703 |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var unpackIEEE754 = require('../internals/ieee754').unpack; | ||
var pow = Math.pow; | ||
var EXP_MASK16 = 31; // 2 ** 5 - 1 | ||
var SIGNIFICAND_MASK16 = 1023; // 2 ** 10 - 1 | ||
var MIN_SUBNORMAL16 = pow(2, -24); // 2 ** -10 * 2 ** -14 | ||
var SIGNIFICAND_DENOM16 = 0.0009765625; // 2 ** -10 | ||
var unpackFloat16 = function (bytes) { | ||
var sign = bytes >>> 15; | ||
var exponent = bytes >>> 10 & EXP_MASK16; | ||
var significand = bytes & SIGNIFICAND_MASK16; | ||
if (exponent === EXP_MASK16) return significand === 0 ? (sign === 0 ? Infinity : -Infinity) : NaN; | ||
if (exponent === 0) return significand * (sign === 0 ? MIN_SUBNORMAL16 : -MIN_SUBNORMAL16); | ||
return pow(2, exponent - 15) * (sign === 0 ? 1 + significand * SIGNIFICAND_DENOM16 : -1 - significand * SIGNIFICAND_DENOM16); | ||
}; | ||
// eslint-disable-next-line es/no-typed-arrays -- safe | ||
@@ -14,4 +29,4 @@ var getUint16 = uncurryThis(DataView.prototype.getUint16); | ||
var uint16 = getUint16(this, byteOffset, arguments.length > 1 ? arguments[1] : false); | ||
return unpackIEEE754([uint16 & 0xFF, uint16 >> 8 & 0xFF], 10); | ||
return unpackFloat16(uint16); | ||
} | ||
}); |
@@ -6,5 +6,38 @@ 'use strict'; | ||
var toIndex = require('../internals/to-index'); | ||
var packIEEE754 = require('../internals/ieee754').pack; | ||
var f16round = require('../internals/math-f16round'); | ||
// TODO: Replace with module dependency in `core-js@4` | ||
var log2 = require('../internals/math-log2'); | ||
var roundTiesToEven = require('../internals/math-round-ties-to-even'); | ||
var pow = Math.pow; | ||
var MIN_INFINITY16 = 65520; // (2 - 2 ** -11) * 2 ** 15 | ||
var MIN_NORMAL16 = 0.000061005353927612305; // (1 - 2 ** -11) * 2 ** -14 | ||
var REC_MIN_SUBNORMAL16 = 16777216; // 2 ** 10 * 2 ** 14 | ||
var REC_SIGNIFICAND_DENOM16 = 1024; // 2 ** 10; | ||
var packFloat16 = function (value) { | ||
// eslint-disable-next-line no-self-compare -- NaN check | ||
if (value !== value) return 0x7E00; // NaN | ||
if (value === 0) return (1 / value === -Infinity) << 15; // +0 or -0 | ||
var neg = value < 0; | ||
if (neg) value = -value; | ||
if (value >= MIN_INFINITY16) return neg << 15 | 0x7C00; // Infinity | ||
if (value < MIN_NORMAL16) return neg << 15 | roundTiesToEven(value * REC_MIN_SUBNORMAL16); // subnormal | ||
// normal | ||
var exponent = log2(value) | 0; | ||
if (exponent === -15) { | ||
// we round from a value between 2 ** -15 * (1 + 1022/1024) (the largest subnormal) and 2 ** -14 * (1 + 0/1024) (the smallest normal) | ||
// to the latter (former impossible because of the subnormal check above) | ||
return neg << 15 | REC_SIGNIFICAND_DENOM16; | ||
} | ||
var significand = roundTiesToEven((value * pow(2, -exponent) - 1) * REC_SIGNIFICAND_DENOM16); | ||
if (significand === REC_SIGNIFICAND_DENOM16) { | ||
// we round from a value between 2 ** n * (1 + 1023/1024) and 2 ** (n + 1) * (1 + 0/1024) to the latter | ||
return neg << 15 | exponent + 16 << 10; | ||
} | ||
return neg << 15 | exponent + 15 << 10 | significand; | ||
}; | ||
// eslint-disable-next-line es/no-typed-arrays -- safe | ||
@@ -19,5 +52,5 @@ var setUint16 = uncurryThis(DataView.prototype.setUint16); | ||
var offset = toIndex(byteOffset); | ||
var bytes = packIEEE754(f16round(value), 10, 2); | ||
return setUint16(this, offset, bytes[1] << 8 | bytes[0], arguments.length > 2 ? arguments[2] : false); | ||
var bytes = packFloat16(+value); | ||
return setUint16(this, offset, bytes, arguments.length > 2 ? arguments[2] : false); | ||
} | ||
}); |
@@ -8,2 +8,3 @@ 'use strict'; | ||
var createIteratorProxy = require('../internals/iterator-create-proxy'); | ||
var createIterResultObject = require('../internals/create-iter-result-object'); | ||
@@ -20,3 +21,3 @@ var $Array = Array; | ||
this.done = true; | ||
return; | ||
return createIterResultObject(undefined, true); | ||
} | ||
@@ -34,5 +35,5 @@ var entry = iterables[iterableIndex]; | ||
} | ||
return result.value; | ||
return result; | ||
} | ||
}); | ||
}, false, true); | ||
@@ -39,0 +40,0 @@ // `Iterator.concat` method |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var f16round = require('../internals/math-f16round'); | ||
var floatRound = require('../internals/math-float-round'); | ||
var FLOAT16_EPSILON = 0.0009765625; | ||
var FLOAT16_MAX_VALUE = 65504; | ||
var FLOAT16_MIN_VALUE = 6.103515625e-05; | ||
// `Math.f16round` method | ||
// https://github.com/tc39/proposal-float16array | ||
$({ target: 'Math', stat: true }, { f16round: f16round }); | ||
$({ target: 'Math', stat: true }, { | ||
f16round: function f16round(x) { | ||
return floatRound(x, FLOAT16_EPSILON, FLOAT16_MAX_VALUE, FLOAT16_MIN_VALUE); | ||
} | ||
}); |
@@ -10,2 +10,3 @@ 'use strict'; | ||
var $Array = Array; | ||
// eslint-disable-next-line es/no-nonstandard-regexp-properties -- safe | ||
var $escape = RegExp.escape; | ||
@@ -12,0 +13,0 @@ var charAt = uncurryThis(''.charAt); |
@@ -9,3 +9,2 @@ 'use strict'; | ||
var toIntegerOrInfinity = require('../internals/to-integer-or-infinity'); | ||
var fails = require('../internals/fails'); | ||
@@ -18,17 +17,2 @@ var aTypedArray = ArrayBufferViewCore.aTypedArray; | ||
// some early implementations, like WebKit, does not follow the final semantic | ||
var PROPER_ORDER = !fails(function () { | ||
// eslint-disable-next-line es/no-typed-arrays -- required for testing | ||
var array = new Int8Array([1]); | ||
var spliced = array.toSpliced(1, 0, { | ||
valueOf: function () { | ||
array[0] = 2; | ||
return 3; | ||
} | ||
}); | ||
return spliced[0] !== 2 || spliced[1] !== 3; | ||
}); | ||
// `%TypedArray%.prototype.toSpliced` method | ||
@@ -70,2 +54,2 @@ // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toSpliced | ||
return A; | ||
}, !PROPER_ORDER); | ||
}, true); |
{ | ||
"name": "core-js", | ||
"version": "3.39.0", | ||
"version": "3.40.0", | ||
"type": "commonjs", | ||
@@ -5,0 +5,0 @@ "description": "Standard library", |
@@ -9,2 +9,3 @@ 'use strict'; | ||
require('../proposals/float16'); | ||
require('../proposals/is-error'); | ||
require('../proposals/json-parse-with-source'); | ||
@@ -11,0 +12,0 @@ require('../proposals/math-sum'); |
Sorry, the diff of this file is not supported yet
1262571
3563
31380