core-js 3.22.4 → 3.22.7
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.
- package/internals/add-to-unscopables.js +2 -2
- package/internals/collection.js +1 -1
- package/internals/define-built-in.js +12 -17
- package/internals/{set-global.js → define-global-property.js} +0 -0
- package/internals/export.js +16 -16
- package/internals/make-built-in.js +10 -2
- package/internals/math-expm1.js +2 -1
- package/internals/math-fround.js +3 -2
- package/internals/math-log1p.js +2 -1
- package/internals/math-sign.js +2 -1
- package/internals/math-trunc.js +10 -0
- package/internals/shared-store.js +2 -2
- package/internals/shared.js +2 -2
- package/internals/to-integer-or-infinity.js +3 -4
- package/internals/typed-array-constructor.js +3 -3
- package/modules/es.aggregate-error.cause.js +1 -1
- package/modules/es.aggregate-error.constructor.js +1 -1
- package/modules/es.array-buffer.constructor.js +1 -1
- package/modules/es.data-view.constructor.js +1 -1
- package/modules/es.error.cause.js +2 -2
- package/modules/es.math.acosh.js +4 -3
- package/modules/es.math.asinh.js +2 -1
- package/modules/es.math.atanh.js +2 -1
- package/modules/es.math.cbrt.js +2 -1
- package/modules/es.math.clz32.js +2 -1
- package/modules/es.math.sinh.js +2 -1
- package/modules/es.math.tanh.js +4 -3
- package/modules/es.math.trunc.js +2 -6
- package/modules/es.number.constructor.js +1 -1
- package/modules/es.promise.constructor.js +1 -1
- package/modules/es.regexp.constructor.js +1 -1
- package/modules/es.symbol.constructor.js +1 -1
- package/modules/es.symbol.description.js +1 -1
- package/modules/esnext.async-iterator.constructor.js +1 -1
- package/modules/esnext.iterator.constructor.js +1 -1
- package/modules/esnext.math.signbit.js +3 -1
- package/modules/esnext.observable.constructor.js +1 -1
- package/modules/web.dom-exception.constructor.js +1 -1
- package/modules/web.dom-exception.stack.js +1 -1
- package/modules/web.queue-microtask.js +1 -1
- package/modules/web.structured-clone.js +21 -9
- package/modules/web.url-search-params.constructor.js +3 -3
- package/modules/web.url.constructor.js +1 -1
- package/package.json +2 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var wellKnownSymbol = require('../internals/well-known-symbol');
|
|
2
2
|
var create = require('../internals/object-create');
|
|
3
|
-
var
|
|
3
|
+
var defineProperty = require('../internals/object-define-property').f;
|
|
4
4
|
|
|
5
5
|
var UNSCOPABLES = wellKnownSymbol('unscopables');
|
|
6
6
|
var ArrayPrototype = Array.prototype;
|
|
@@ -8,7 +8,7 @@ var ArrayPrototype = Array.prototype;
|
|
|
8
8
|
// Array.prototype[@@unscopables]
|
|
9
9
|
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
10
10
|
if (ArrayPrototype[UNSCOPABLES] == undefined) {
|
|
11
|
-
|
|
11
|
+
defineProperty(ArrayPrototype, UNSCOPABLES, {
|
|
12
12
|
configurable: true,
|
|
13
13
|
value: create(null)
|
|
14
14
|
});
|
package/internals/collection.js
CHANGED
|
@@ -95,7 +95,7 @@ module.exports = function (CONSTRUCTOR_NAME, wrapper, common) {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
exported[CONSTRUCTOR_NAME] = Constructor;
|
|
98
|
-
$({ global: true, forced: Constructor != NativeConstructor }, exported);
|
|
98
|
+
$({ global: true, constructor: true, forced: Constructor != NativeConstructor }, exported);
|
|
99
99
|
|
|
100
100
|
setToStringTag(Constructor, CONSTRUCTOR_NAME);
|
|
101
101
|
|
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
var global = require('../internals/global');
|
|
2
1
|
var isCallable = require('../internals/is-callable');
|
|
3
2
|
var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
|
4
3
|
var makeBuiltIn = require('../internals/make-built-in');
|
|
5
|
-
var
|
|
4
|
+
var defineGlobalProperty = require('../internals/define-global-property');
|
|
6
5
|
|
|
7
6
|
module.exports = function (O, key, value, options) {
|
|
8
|
-
|
|
9
|
-
var simple = options
|
|
10
|
-
var
|
|
11
|
-
var name = options && options.name !== undefined ? options.name : key;
|
|
7
|
+
if (!options) options = {};
|
|
8
|
+
var simple = options.enumerable;
|
|
9
|
+
var name = options.name !== undefined ? options.name : key;
|
|
12
10
|
if (isCallable(value)) makeBuiltIn(value, name, options);
|
|
13
|
-
if (
|
|
11
|
+
if (options.global) {
|
|
14
12
|
if (simple) O[key] = value;
|
|
15
|
-
else
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
if (simple) O[key] = value;
|
|
23
|
-
else createNonEnumerableProperty(O, key, value);
|
|
24
|
-
return O;
|
|
13
|
+
else defineGlobalProperty(key, value);
|
|
14
|
+
} else {
|
|
15
|
+
if (!options.unsafe) delete O[key];
|
|
16
|
+
else if (O[key]) simple = true;
|
|
17
|
+
if (simple) O[key] = value;
|
|
18
|
+
else createNonEnumerableProperty(O, key, value);
|
|
19
|
+
} return O;
|
|
25
20
|
};
|
|
File without changes
|
package/internals/export.js
CHANGED
|
@@ -2,24 +2,24 @@ var global = require('../internals/global');
|
|
|
2
2
|
var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
|
|
3
3
|
var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
|
4
4
|
var defineBuiltIn = require('../internals/define-built-in');
|
|
5
|
-
var
|
|
5
|
+
var defineGlobalProperty = require('../internals/define-global-property');
|
|
6
6
|
var copyConstructorProperties = require('../internals/copy-constructor-properties');
|
|
7
7
|
var isForced = require('../internals/is-forced');
|
|
8
8
|
|
|
9
9
|
/*
|
|
10
|
-
options.target
|
|
11
|
-
options.global
|
|
12
|
-
options.stat
|
|
13
|
-
options.proto
|
|
14
|
-
options.real
|
|
15
|
-
options.forced
|
|
16
|
-
options.bind
|
|
17
|
-
options.wrap
|
|
18
|
-
options.unsafe
|
|
19
|
-
options.sham
|
|
20
|
-
options.enumerable
|
|
21
|
-
options.
|
|
22
|
-
options.name
|
|
10
|
+
options.target - name of the target object
|
|
11
|
+
options.global - target is the global object
|
|
12
|
+
options.stat - export as static methods of target
|
|
13
|
+
options.proto - export as prototype methods of target
|
|
14
|
+
options.real - real prototype method for the `pure` version
|
|
15
|
+
options.forced - export even if the native feature is available
|
|
16
|
+
options.bind - bind methods to the target, required for the `pure` version
|
|
17
|
+
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
|
|
18
|
+
options.unsafe - use the simple assignment of property instead of delete + defineProperty
|
|
19
|
+
options.sham - add a flag to not completely full polyfills
|
|
20
|
+
options.enumerable - export as enumerable property
|
|
21
|
+
options.dontCallGetSet - prevent calling a getter on target
|
|
22
|
+
options.name - the .name of the function if it does not match the key
|
|
23
23
|
*/
|
|
24
24
|
module.exports = function (options, source) {
|
|
25
25
|
var TARGET = options.target;
|
|
@@ -29,13 +29,13 @@ module.exports = function (options, source) {
|
|
|
29
29
|
if (GLOBAL) {
|
|
30
30
|
target = global;
|
|
31
31
|
} else if (STATIC) {
|
|
32
|
-
target = global[TARGET] ||
|
|
32
|
+
target = global[TARGET] || defineGlobalProperty(TARGET, {});
|
|
33
33
|
} else {
|
|
34
34
|
target = (global[TARGET] || {}).prototype;
|
|
35
35
|
}
|
|
36
36
|
if (target) for (key in source) {
|
|
37
37
|
sourceProperty = source[key];
|
|
38
|
-
if (options.
|
|
38
|
+
if (options.dontCallGetSet) {
|
|
39
39
|
descriptor = getOwnPropertyDescriptor(target, key);
|
|
40
40
|
targetProperty = descriptor && descriptor.value;
|
|
41
41
|
} else targetProperty = target[key];
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
var fails = require('../internals/fails');
|
|
2
2
|
var isCallable = require('../internals/is-callable');
|
|
3
3
|
var hasOwn = require('../internals/has-own-property');
|
|
4
|
-
var
|
|
4
|
+
var DESCRIPTORS = require('../internals/descriptors');
|
|
5
5
|
var CONFIGURABLE_FUNCTION_NAME = require('../internals/function-name').CONFIGURABLE;
|
|
6
6
|
var inspectSource = require('../internals/inspect-source');
|
|
7
7
|
var InternalStateModule = require('../internals/internal-state');
|
|
8
8
|
|
|
9
9
|
var enforceInternalState = InternalStateModule.enforce;
|
|
10
10
|
var getInternalState = InternalStateModule.get;
|
|
11
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
|
|
12
|
+
var defineProperty = Object.defineProperty;
|
|
11
13
|
|
|
12
|
-
var CONFIGURABLE_LENGTH = !fails(function () {
|
|
14
|
+
var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function () {
|
|
13
15
|
return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
|
|
14
16
|
});
|
|
15
17
|
|
|
@@ -27,6 +29,12 @@ var makeBuiltIn = module.exports = function (value, name, options) {
|
|
|
27
29
|
if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) {
|
|
28
30
|
defineProperty(value, 'length', { value: options.arity });
|
|
29
31
|
}
|
|
32
|
+
try {
|
|
33
|
+
if (options && hasOwn(options, 'constructor') && options.constructor) {
|
|
34
|
+
if (DESCRIPTORS) defineProperty(value, 'prototype', { writable: false });
|
|
35
|
+
// in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
|
|
36
|
+
} else if (value.prototype) value.prototype = undefined;
|
|
37
|
+
} catch (error) { /* empty */ }
|
|
30
38
|
var state = enforceInternalState(value);
|
|
31
39
|
if (!hasOwn(state, 'source')) {
|
|
32
40
|
state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
|
package/internals/math-expm1.js
CHANGED
|
@@ -10,5 +10,6 @@ module.exports = (!$expm1
|
|
|
10
10
|
// Tor Browser bug
|
|
11
11
|
|| $expm1(-2e-17) != -2e-17
|
|
12
12
|
) ? function expm1(x) {
|
|
13
|
-
|
|
13
|
+
var n = +x;
|
|
14
|
+
return n == 0 ? n : n > -1e-6 && n < 1e-6 ? n + n * n / 2 : exp(n) - 1;
|
|
14
15
|
} : $expm1;
|
package/internals/math-fround.js
CHANGED
|
@@ -15,8 +15,9 @@ var roundTiesToEven = function (n) {
|
|
|
15
15
|
// https://tc39.es/ecma262/#sec-math.fround
|
|
16
16
|
// eslint-disable-next-line es-x/no-math-fround -- safe
|
|
17
17
|
module.exports = Math.fround || function fround(x) {
|
|
18
|
-
var
|
|
19
|
-
var $
|
|
18
|
+
var n = +x;
|
|
19
|
+
var $abs = abs(n);
|
|
20
|
+
var $sign = sign(n);
|
|
20
21
|
var a, result;
|
|
21
22
|
if ($abs < MIN32) return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32;
|
|
22
23
|
a = (1 + EPSILON32 / EPSILON) * $abs;
|
package/internals/math-log1p.js
CHANGED
|
@@ -4,5 +4,6 @@ var log = Math.log;
|
|
|
4
4
|
// https://tc39.es/ecma262/#sec-math.log1p
|
|
5
5
|
// eslint-disable-next-line es-x/no-math-log1p -- safe
|
|
6
6
|
module.exports = Math.log1p || function log1p(x) {
|
|
7
|
-
|
|
7
|
+
var n = +x;
|
|
8
|
+
return n > -1e-8 && n < 1e-8 ? n - n * n / 2 : log(1 + n);
|
|
8
9
|
};
|
package/internals/math-sign.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// https://tc39.es/ecma262/#sec-math.sign
|
|
3
3
|
// eslint-disable-next-line es-x/no-math-sign -- safe
|
|
4
4
|
module.exports = Math.sign || function sign(x) {
|
|
5
|
+
var n = +x;
|
|
5
6
|
// eslint-disable-next-line no-self-compare -- NaN check
|
|
6
|
-
return
|
|
7
|
+
return n == 0 || n != n ? n : n < 0 ? -1 : 1;
|
|
7
8
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var ceil = Math.ceil;
|
|
2
|
+
var floor = Math.floor;
|
|
3
|
+
|
|
4
|
+
// `Math.trunc` method
|
|
5
|
+
// https://tc39.es/ecma262/#sec-math.trunc
|
|
6
|
+
// eslint-disable-next-line es-x/no-math-trunc -- safe
|
|
7
|
+
module.exports = Math.trunc || function trunc(x) {
|
|
8
|
+
var n = +x;
|
|
9
|
+
return (n > 0 ? floor : ceil)(n);
|
|
10
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var global = require('../internals/global');
|
|
2
|
-
var
|
|
2
|
+
var defineGlobalProperty = require('../internals/define-global-property');
|
|
3
3
|
|
|
4
4
|
var SHARED = '__core-js_shared__';
|
|
5
|
-
var store = global[SHARED] ||
|
|
5
|
+
var store = global[SHARED] || defineGlobalProperty(SHARED, {});
|
|
6
6
|
|
|
7
7
|
module.exports = store;
|
package/internals/shared.js
CHANGED
|
@@ -4,9 +4,9 @@ var store = require('../internals/shared-store');
|
|
|
4
4
|
(module.exports = function (key, value) {
|
|
5
5
|
return store[key] || (store[key] = value !== undefined ? value : {});
|
|
6
6
|
})('versions', []).push({
|
|
7
|
-
version: '3.22.
|
|
7
|
+
version: '3.22.7',
|
|
8
8
|
mode: IS_PURE ? 'pure' : 'global',
|
|
9
9
|
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
|
|
10
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.22.
|
|
10
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.22.7/LICENSE',
|
|
11
11
|
source: 'https://github.com/zloirock/core-js'
|
|
12
12
|
});
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
var floor = Math.floor;
|
|
1
|
+
var trunc = require('../internals/math-trunc');
|
|
3
2
|
|
|
4
3
|
// `ToIntegerOrInfinity` abstract operation
|
|
5
4
|
// https://tc39.es/ecma262/#sec-tointegerorinfinity
|
|
6
5
|
module.exports = function (argument) {
|
|
7
6
|
var number = +argument;
|
|
8
|
-
// eslint-disable-next-line no-self-compare --
|
|
9
|
-
return number !== number || number === 0 ? 0 : (number
|
|
7
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
8
|
+
return number !== number || number === 0 ? 0 : trunc(number);
|
|
10
9
|
};
|
|
@@ -223,11 +223,11 @@ if (DESCRIPTORS) {
|
|
|
223
223
|
createNonEnumerableProperty(TypedArrayConstructorPrototype, TYPED_ARRAY_TAG, CONSTRUCTOR_NAME);
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
+
var FORCED = TypedArrayConstructor != NativeTypedArrayConstructor;
|
|
227
|
+
|
|
226
228
|
exported[CONSTRUCTOR_NAME] = TypedArrayConstructor;
|
|
227
229
|
|
|
228
|
-
$({
|
|
229
|
-
global: true, forced: TypedArrayConstructor != NativeTypedArrayConstructor, sham: !NATIVE_ARRAY_BUFFER_VIEWS
|
|
230
|
-
}, exported);
|
|
230
|
+
$({ global: true, constructor: true, forced: FORCED, sham: !NATIVE_ARRAY_BUFFER_VIEWS }, exported);
|
|
231
231
|
|
|
232
232
|
if (!(BYTES_PER_ELEMENT in TypedArrayConstructor)) {
|
|
233
233
|
createNonEnumerableProperty(TypedArrayConstructor, BYTES_PER_ELEMENT, BYTES);
|
|
@@ -13,7 +13,7 @@ var FORCED = !fails(function () {
|
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
// https://github.com/tc39/proposal-error-cause
|
|
16
|
-
$({ global: true, arity: 2, forced: FORCED }, {
|
|
16
|
+
$({ global: true, constructor: true, arity: 2, forced: FORCED }, {
|
|
17
17
|
AggregateError: wrapErrorConstructorWithCause(AGGREGATE_ERROR, function (init) {
|
|
18
18
|
// eslint-disable-next-line no-unused-vars -- required for functions `.length`
|
|
19
19
|
return function AggregateError(errors, message) { return apply(init, this, arguments); };
|
|
@@ -49,6 +49,6 @@ var AggregateErrorPrototype = $AggregateError.prototype = create(Error.prototype
|
|
|
49
49
|
|
|
50
50
|
// `AggregateError` constructor
|
|
51
51
|
// https://tc39.es/ecma262/#sec-aggregate-error-constructor
|
|
52
|
-
$({ global: true }, {
|
|
52
|
+
$({ global: true, constructor: true, arity: 2 }, {
|
|
53
53
|
AggregateError: $AggregateError
|
|
54
54
|
});
|
|
@@ -10,7 +10,7 @@ var NativeArrayBuffer = global[ARRAY_BUFFER];
|
|
|
10
10
|
|
|
11
11
|
// `ArrayBuffer` constructor
|
|
12
12
|
// https://tc39.es/ecma262/#sec-arraybuffer-constructor
|
|
13
|
-
$({ global: true, forced: NativeArrayBuffer !== ArrayBuffer }, {
|
|
13
|
+
$({ global: true, constructor: true, forced: NativeArrayBuffer !== ArrayBuffer }, {
|
|
14
14
|
ArrayBuffer: ArrayBuffer
|
|
15
15
|
});
|
|
16
16
|
|
|
@@ -4,6 +4,6 @@ var NATIVE_ARRAY_BUFFER = require('../internals/array-buffer-native');
|
|
|
4
4
|
|
|
5
5
|
// `DataView` constructor
|
|
6
6
|
// https://tc39.es/ecma262/#sec-dataview-constructor
|
|
7
|
-
$({ global: true, forced: !NATIVE_ARRAY_BUFFER }, {
|
|
7
|
+
$({ global: true, constructor: true, forced: !NATIVE_ARRAY_BUFFER }, {
|
|
8
8
|
DataView: ArrayBufferModule.DataView
|
|
9
9
|
});
|
|
@@ -12,14 +12,14 @@ var FORCED = Error('e', { cause: 7 }).cause !== 7;
|
|
|
12
12
|
var exportGlobalErrorCauseWrapper = function (ERROR_NAME, wrapper) {
|
|
13
13
|
var O = {};
|
|
14
14
|
O[ERROR_NAME] = wrapErrorConstructorWithCause(ERROR_NAME, wrapper, FORCED);
|
|
15
|
-
$({ global: true, arity: 1, forced: FORCED }, O);
|
|
15
|
+
$({ global: true, constructor: true, arity: 1, forced: FORCED }, O);
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
var exportWebAssemblyErrorCauseWrapper = function (ERROR_NAME, wrapper) {
|
|
19
19
|
if (WebAssembly && WebAssembly[ERROR_NAME]) {
|
|
20
20
|
var O = {};
|
|
21
21
|
O[ERROR_NAME] = wrapErrorConstructorWithCause(WEB_ASSEMBLY + '.' + ERROR_NAME, wrapper, FORCED);
|
|
22
|
-
$({ target: WEB_ASSEMBLY, stat: true, arity: 1, forced: FORCED }, O);
|
|
22
|
+
$({ target: WEB_ASSEMBLY, stat: true, constructor: true, arity: 1, forced: FORCED }, O);
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
|
package/modules/es.math.acosh.js
CHANGED
|
@@ -17,8 +17,9 @@ var FORCED = !$acosh
|
|
|
17
17
|
// https://tc39.es/ecma262/#sec-math.acosh
|
|
18
18
|
$({ target: 'Math', stat: true, forced: FORCED }, {
|
|
19
19
|
acosh: function acosh(x) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
var n = +x;
|
|
21
|
+
return n < 1 ? NaN : n > 94906265.62425156
|
|
22
|
+
? log(n) + LN2
|
|
23
|
+
: log1p(n - 1 + sqrt(n - 1) * sqrt(n + 1));
|
|
23
24
|
}
|
|
24
25
|
});
|
package/modules/es.math.asinh.js
CHANGED
|
@@ -6,7 +6,8 @@ var log = Math.log;
|
|
|
6
6
|
var sqrt = Math.sqrt;
|
|
7
7
|
|
|
8
8
|
function asinh(x) {
|
|
9
|
-
|
|
9
|
+
var n = +x;
|
|
10
|
+
return !isFinite(n) || n == 0 ? n : n < 0 ? -asinh(-n) : log(n + sqrt(n * n + 1));
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
// `Math.asinh` method
|
package/modules/es.math.atanh.js
CHANGED
|
@@ -9,6 +9,7 @@ var log = Math.log;
|
|
|
9
9
|
// Tor Browser bug: Math.atanh(-0) -> 0
|
|
10
10
|
$({ target: 'Math', stat: true, forced: !($atanh && 1 / $atanh(-0) < 0) }, {
|
|
11
11
|
atanh: function atanh(x) {
|
|
12
|
-
|
|
12
|
+
var n = +x;
|
|
13
|
+
return n == 0 ? n : log((1 + n) / (1 - n)) / 2;
|
|
13
14
|
}
|
|
14
15
|
});
|
package/modules/es.math.cbrt.js
CHANGED
package/modules/es.math.clz32.js
CHANGED
|
@@ -8,6 +8,7 @@ var LOG2E = Math.LOG2E;
|
|
|
8
8
|
// https://tc39.es/ecma262/#sec-math.clz32
|
|
9
9
|
$({ target: 'Math', stat: true }, {
|
|
10
10
|
clz32: function clz32(x) {
|
|
11
|
-
|
|
11
|
+
var n = x >>> 0;
|
|
12
|
+
return n ? 31 - floor(log(n + 0.5) * LOG2E) : 32;
|
|
12
13
|
}
|
|
13
14
|
});
|
package/modules/es.math.sinh.js
CHANGED
|
@@ -16,6 +16,7 @@ var FORCED = fails(function () {
|
|
|
16
16
|
// V8 near Chromium 38 has a problem with very small numbers
|
|
17
17
|
$({ target: 'Math', stat: true, forced: FORCED }, {
|
|
18
18
|
sinh: function sinh(x) {
|
|
19
|
-
|
|
19
|
+
var n = +x;
|
|
20
|
+
return abs(n) < 1 ? (expm1(n) - expm1(-n)) / 2 : (exp(n - 1) - exp(-n - 1)) * (E / 2);
|
|
20
21
|
}
|
|
21
22
|
});
|
package/modules/es.math.tanh.js
CHANGED
|
@@ -7,8 +7,9 @@ var exp = Math.exp;
|
|
|
7
7
|
// https://tc39.es/ecma262/#sec-math.tanh
|
|
8
8
|
$({ target: 'Math', stat: true }, {
|
|
9
9
|
tanh: function tanh(x) {
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
|
|
10
|
+
var n = +x;
|
|
11
|
+
var a = expm1(n);
|
|
12
|
+
var b = expm1(-n);
|
|
13
|
+
return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(n) + exp(-n));
|
|
13
14
|
}
|
|
14
15
|
});
|
package/modules/es.math.trunc.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
var $ = require('../internals/export');
|
|
2
|
-
|
|
3
|
-
var ceil = Math.ceil;
|
|
4
|
-
var floor = Math.floor;
|
|
2
|
+
var trunc = require('../internals/math-trunc');
|
|
5
3
|
|
|
6
4
|
// `Math.trunc` method
|
|
7
5
|
// https://tc39.es/ecma262/#sec-math.trunc
|
|
8
6
|
$({ target: 'Math', stat: true }, {
|
|
9
|
-
trunc:
|
|
10
|
-
return (it > 0 ? floor : ceil)(it);
|
|
11
|
-
}
|
|
7
|
+
trunc: trunc
|
|
12
8
|
});
|
|
@@ -84,5 +84,5 @@ if (isForced(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumb
|
|
|
84
84
|
}
|
|
85
85
|
NumberWrapper.prototype = NumberPrototype;
|
|
86
86
|
NumberPrototype.constructor = NumberWrapper;
|
|
87
|
-
defineBuiltIn(global, NUMBER, NumberWrapper);
|
|
87
|
+
defineBuiltIn(global, NUMBER, NumberWrapper, { constructor: true });
|
|
88
88
|
}
|
|
@@ -280,7 +280,7 @@ if (FORCED_PROMISE_CONSTRUCTOR) {
|
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
$({ global: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
|
|
283
|
+
$({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
|
|
284
284
|
Promise: PromiseConstructor
|
|
285
285
|
});
|
|
286
286
|
|
|
@@ -183,7 +183,7 @@ if (isForced('RegExp', BASE_FORCED)) {
|
|
|
183
183
|
|
|
184
184
|
RegExpPrototype.constructor = RegExpWrapper;
|
|
185
185
|
RegExpWrapper.prototype = RegExpPrototype;
|
|
186
|
-
defineBuiltIn(global, 'RegExp', RegExpWrapper);
|
|
186
|
+
defineBuiltIn(global, 'RegExp', RegExpWrapper, { constructor: true });
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
// https://tc39.es/ecma262/#sec-get-regexp-@@species
|
|
@@ -207,7 +207,7 @@ if (!NATIVE_SYMBOL) {
|
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
$({ global: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, {
|
|
210
|
+
$({ global: true, constructor: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, {
|
|
211
211
|
Symbol: $Symbol
|
|
212
212
|
});
|
|
213
213
|
|
|
@@ -24,6 +24,6 @@ if (IS_PURE || !hasOwn(AsyncIteratorPrototype, 'constructor') || AsyncIteratorPr
|
|
|
24
24
|
createNonEnumerableProperty(AsyncIteratorPrototype, 'constructor', AsyncIteratorConstructor);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
$({ global: true, forced: IS_PURE }, {
|
|
27
|
+
$({ global: true, constructor: true, forced: IS_PURE }, {
|
|
28
28
|
AsyncIterator: AsyncIteratorConstructor
|
|
29
29
|
});
|
|
@@ -36,6 +36,6 @@ if (FORCED || !hasOwn(IteratorPrototype, 'constructor') || IteratorPrototype.con
|
|
|
36
36
|
|
|
37
37
|
IteratorConstructor.prototype = IteratorPrototype;
|
|
38
38
|
|
|
39
|
-
$({ global: true, forced: FORCED }, {
|
|
39
|
+
$({ global: true, constructor: true, forced: FORCED }, {
|
|
40
40
|
Iterator: IteratorConstructor
|
|
41
41
|
});
|
|
@@ -4,6 +4,8 @@ var $ = require('../internals/export');
|
|
|
4
4
|
// https://github.com/tc39/proposal-Math.signbit
|
|
5
5
|
$({ target: 'Math', stat: true, forced: true }, {
|
|
6
6
|
signbit: function signbit(x) {
|
|
7
|
-
|
|
7
|
+
var n = +x;
|
|
8
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
9
|
+
return n == n && n == 0 ? 1 / n == -Infinity : n < 0;
|
|
8
10
|
}
|
|
9
11
|
});
|
|
@@ -180,7 +180,7 @@ defineBuiltIns(ObservablePrototype, {
|
|
|
180
180
|
|
|
181
181
|
defineBuiltIn(ObservablePrototype, $$OBSERVABLE, function () { return this; });
|
|
182
182
|
|
|
183
|
-
$({ global: true, forced: OBSERVABLE_FORCED }, {
|
|
183
|
+
$({ global: true, constructor: true, forced: OBSERVABLE_FORCED }, {
|
|
184
184
|
Observable: $Observable
|
|
185
185
|
});
|
|
186
186
|
|
|
@@ -111,7 +111,7 @@ var FORCED_CONSTRUCTOR = IS_PURE ? INCORRECT_TO_STRING || INCORRECT_CODE || MISS
|
|
|
111
111
|
|
|
112
112
|
// `DOMException` constructor
|
|
113
113
|
// https://webidl.spec.whatwg.org/#idl-DOMException
|
|
114
|
-
$({ global: true, forced: FORCED_CONSTRUCTOR }, {
|
|
114
|
+
$({ global: true, constructor: true, forced: FORCED_CONSTRUCTOR }, {
|
|
115
115
|
DOMException: FORCED_CONSTRUCTOR ? $DOMException : NativeDOMException
|
|
116
116
|
});
|
|
117
117
|
|
|
@@ -36,7 +36,7 @@ var FORCED_CONSTRUCTOR = ERROR_HAS_STACK && !DOM_EXCEPTION_HAS_STACK;
|
|
|
36
36
|
|
|
37
37
|
// `DOMException` constructor patch for `.stack` where it's required
|
|
38
38
|
// https://webidl.spec.whatwg.org/#es-DOMException-specialness
|
|
39
|
-
$({ global: true, forced: IS_PURE || FORCED_CONSTRUCTOR }, { // TODO: fix export logic
|
|
39
|
+
$({ global: true, constructor: true, forced: IS_PURE || FORCED_CONSTRUCTOR }, { // TODO: fix export logic
|
|
40
40
|
DOMException: FORCED_CONSTRUCTOR ? $DOMException : NativeDOMException
|
|
41
41
|
});
|
|
42
42
|
|
|
@@ -9,7 +9,7 @@ var process = global.process;
|
|
|
9
9
|
|
|
10
10
|
// `queueMicrotask` method
|
|
11
11
|
// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-queuemicrotask
|
|
12
|
-
$({ global: true, enumerable: true,
|
|
12
|
+
$({ global: true, enumerable: true, dontCallGetSet: true }, {
|
|
13
13
|
queueMicrotask: function queueMicrotask(fn) {
|
|
14
14
|
validateArgumentsLength(arguments.length, 1);
|
|
15
15
|
aCallable(fn);
|
|
@@ -61,30 +61,42 @@ var checkBasicSemantic = function (structuredCloneImplementation) {
|
|
|
61
61
|
}) && structuredCloneImplementation;
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
+
var checkErrorsCloning = function (structuredCloneImplementation) {
|
|
65
|
+
return !fails(function () {
|
|
66
|
+
var error = new Error();
|
|
67
|
+
var test = structuredCloneImplementation({ a: error, b: error });
|
|
68
|
+
return !(test && test.a === test.b && test.a instanceof Error);
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
|
|
64
72
|
// https://github.com/whatwg/html/pull/5749
|
|
65
|
-
var
|
|
73
|
+
var checkNewErrorsCloningSemantic = function (structuredCloneImplementation) {
|
|
66
74
|
return !fails(function () {
|
|
67
75
|
var test = structuredCloneImplementation(new global.AggregateError([1], PERFORMANCE_MARK, { cause: 3 }));
|
|
68
76
|
return test.name != 'AggregateError' || test.errors[0] != 1 || test.message != PERFORMANCE_MARK || test.cause != 3;
|
|
69
|
-
})
|
|
77
|
+
});
|
|
70
78
|
};
|
|
71
79
|
|
|
72
|
-
// FF94+, Safari
|
|
73
|
-
//
|
|
80
|
+
// FF94+, Safari 15.4+, Chrome 98+, NodeJS 17.0+, Deno 1.13+
|
|
81
|
+
// FF and Safari implementations can't clone errors
|
|
74
82
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=1556604
|
|
83
|
+
// Chrome <103 returns `null` if cloned object contains multiple references to one error
|
|
84
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=12542
|
|
75
85
|
// no one of current implementations supports new (html/5749) error cloning semantic
|
|
76
86
|
var nativeStructuredClone = global.structuredClone;
|
|
77
87
|
|
|
78
|
-
var FORCED_REPLACEMENT = IS_PURE || !
|
|
88
|
+
var FORCED_REPLACEMENT = IS_PURE || !checkErrorsCloning(nativeStructuredClone) || !checkNewErrorsCloningSemantic(nativeStructuredClone);
|
|
79
89
|
|
|
80
90
|
// Chrome 82+, Safari 14.1+, Deno 1.11+
|
|
81
91
|
// Chrome 78-81 implementation swaps `.name` and `.message` of cloned `DOMException`
|
|
92
|
+
// Chrome returns `null` if cloned object contains multiple references to one error
|
|
82
93
|
// Safari 14.1 implementation doesn't clone some `RegExp` flags, so requires a workaround
|
|
83
|
-
//
|
|
94
|
+
// Safari implementation can't clone errors
|
|
84
95
|
// Deno 1.2-1.10 implementations too naive
|
|
85
|
-
// NodeJS 16.0+ does not have `PerformanceMark` constructor
|
|
86
|
-
//
|
|
87
|
-
//
|
|
96
|
+
// NodeJS 16.0+ does not have `PerformanceMark` constructor
|
|
97
|
+
// NodeJS <17.2 structured cloning implementation from `performance.mark` is too naive
|
|
98
|
+
// and can't clone, for example, `RegExp` or some boxed primitives
|
|
99
|
+
// https://github.com/nodejs/node/issues/40840
|
|
88
100
|
// no one of current implementations supports new (html/5749) error cloning semantic
|
|
89
101
|
var structuredCloneFromMark = !nativeStructuredClone && checkBasicSemantic(function (value) {
|
|
90
102
|
return new PerformanceMark(PERFORMANCE_MARK, { detail: value }).detail;
|
|
@@ -337,7 +337,7 @@ defineBuiltIn(URLSearchParamsPrototype, 'toString', function toString() {
|
|
|
337
337
|
|
|
338
338
|
setToStringTag(URLSearchParamsConstructor, URL_SEARCH_PARAMS);
|
|
339
339
|
|
|
340
|
-
$({ global: true, forced: !USE_NATIVE_URL }, {
|
|
340
|
+
$({ global: true, constructor: true, forced: !USE_NATIVE_URL }, {
|
|
341
341
|
URLSearchParams: URLSearchParamsConstructor
|
|
342
342
|
});
|
|
343
343
|
|
|
@@ -364,7 +364,7 @@ if (!USE_NATIVE_URL && isCallable(Headers)) {
|
|
|
364
364
|
};
|
|
365
365
|
|
|
366
366
|
if (isCallable(nativeFetch)) {
|
|
367
|
-
$({ global: true, enumerable: true,
|
|
367
|
+
$({ global: true, enumerable: true, dontCallGetSet: true, forced: true }, {
|
|
368
368
|
fetch: function fetch(input /* , init */) {
|
|
369
369
|
return nativeFetch(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {});
|
|
370
370
|
}
|
|
@@ -380,7 +380,7 @@ if (!USE_NATIVE_URL && isCallable(Headers)) {
|
|
|
380
380
|
RequestPrototype.constructor = RequestConstructor;
|
|
381
381
|
RequestConstructor.prototype = RequestPrototype;
|
|
382
382
|
|
|
383
|
-
$({ global: true,
|
|
383
|
+
$({ global: true, constructor: true, dontCallGetSet: true, forced: true }, {
|
|
384
384
|
Request: RequestConstructor
|
|
385
385
|
});
|
|
386
386
|
}
|
|
@@ -1037,6 +1037,6 @@ if (NativeURL) {
|
|
|
1037
1037
|
|
|
1038
1038
|
setToStringTag(URLConstructor, 'URL');
|
|
1039
1039
|
|
|
1040
|
-
$({ global: true, forced: !USE_NATIVE_URL, sham: !DESCRIPTORS }, {
|
|
1040
|
+
$({ global: true, constructor: true, forced: !USE_NATIVE_URL, sham: !DESCRIPTORS }, {
|
|
1041
1041
|
URL: URLConstructor
|
|
1042
1042
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "core-js",
|
|
3
3
|
"description": "Standard library",
|
|
4
|
-
"version": "3.22.
|
|
4
|
+
"version": "3.22.7",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/zloirock/core-js.git"
|
|
@@ -53,6 +53,5 @@
|
|
|
53
53
|
],
|
|
54
54
|
"scripts": {
|
|
55
55
|
"postinstall": "node -e \"try{require('./postinstall')}catch(e){}\""
|
|
56
|
-
}
|
|
57
|
-
"gitHead": "6ba79a5aada7286aa44ca9e4029cbb74dd84ffd6"
|
|
56
|
+
}
|
|
58
57
|
}
|