core-js 3.39.0 → 3.41.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.
- package/LICENSE +1 -1
- package/actual/data-view/get-float16.js +3 -0
- package/actual/data-view/set-float16.js +3 -0
- package/actual/error/index.js +2 -0
- package/actual/error/is-error.js +6 -0
- package/actual/math/f16round.js +2 -2
- package/actual/regexp/escape.js +2 -2
- package/es/data-view/get-float16.js +2 -0
- package/es/data-view/index.js +2 -0
- package/es/data-view/set-float16.js +2 -0
- package/es/index.js +4 -0
- package/es/math/f16round.js +5 -0
- package/es/math/index.js +1 -0
- package/es/regexp/escape.js +5 -0
- package/es/regexp/index.js +1 -0
- package/features/error/is-error.js +2 -0
- package/full/error/is-error.js +4 -0
- package/full/index.js +5 -0
- package/internals/a-number.js +7 -0
- package/internals/add-disposable-resource.js +7 -1
- package/internals/array-buffer-is-detached.js +5 -7
- package/internals/function-apply.js +1 -1
- package/internals/function-call.js +1 -1
- package/internals/function-uncurry-this.js +1 -0
- package/internals/iterator-create-proxy.js +6 -4
- package/internals/math-float-round.js +1 -5
- package/internals/math-log2.js +10 -0
- package/internals/math-round-ties-to-even.js +7 -0
- package/internals/math-scale.js +1 -1
- package/internals/native-raw-json.js +2 -0
- package/internals/object-assign.js +1 -0
- package/internals/set-method-accept-set-like.js +25 -2
- package/internals/shared-store.js +3 -3
- package/modules/es.data-view.get-float16.js +31 -0
- package/modules/es.data-view.set-float16.js +54 -0
- package/modules/es.math.f16round.js +15 -0
- package/modules/es.math.log2.js +2 -6
- package/modules/es.regexp.escape.js +70 -0
- package/modules/es.set.difference.v2.js +5 -1
- package/modules/es.set.intersection.v2.js +4 -2
- package/modules/es.set.is-disjoint-from.v2.js +5 -1
- package/modules/es.set.is-subset-of.v2.js +5 -1
- package/modules/es.set.is-superset-of.v2.js +5 -1
- package/modules/esnext.array.from-async.js +1 -0
- package/modules/esnext.async-disposable-stack.constructor.js +6 -1
- package/modules/esnext.async-iterator.flat-map.js +1 -1
- package/modules/esnext.data-view.get-float16.js +2 -15
- package/modules/esnext.data-view.set-float16.js +2 -20
- package/modules/esnext.error.is-error.js +36 -0
- package/modules/esnext.iterator.concat.js +4 -3
- package/modules/esnext.math.clamp.js +13 -5
- package/modules/esnext.math.f16round.js +2 -6
- package/modules/esnext.regexp.escape.js +2 -69
- package/modules/esnext.typed-array.to-spliced.js +1 -17
- package/package.json +1 -1
- package/proposals/is-error.js +3 -0
- package/proposals/math-clamp.js +3 -0
- package/stable/data-view/get-float16.js +4 -0
- package/stable/data-view/set-float16.js +4 -0
- package/stable/index.js +4 -0
- package/stable/math/f16round.js +4 -0
- package/stable/regexp/escape.js +4 -0
- package/stage/1.js +1 -0
- package/stage/3.js +1 -2
- package/stage/4.js +2 -0
- package/internals/math-f16round.js +0 -12
package/LICENSE
CHANGED
package/actual/error/index.js
CHANGED
package/actual/math/f16round.js
CHANGED
package/actual/regexp/escape.js
CHANGED
package/es/data-view/index.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
require('../../modules/es.array-buffer.constructor');
|
|
3
3
|
require('../../modules/es.array-buffer.slice');
|
|
4
4
|
require('../../modules/es.data-view');
|
|
5
|
+
require('../../modules/es.data-view.get-float16');
|
|
6
|
+
require('../../modules/es.data-view.set-float16');
|
|
5
7
|
require('../../modules/es.object.to-string');
|
|
6
8
|
var path = require('../../internals/path');
|
|
7
9
|
|
package/es/index.js
CHANGED
|
@@ -60,6 +60,8 @@ require('../modules/es.array-buffer.constructor');
|
|
|
60
60
|
require('../modules/es.array-buffer.is-view');
|
|
61
61
|
require('../modules/es.array-buffer.slice');
|
|
62
62
|
require('../modules/es.data-view');
|
|
63
|
+
require('../modules/es.data-view.get-float16');
|
|
64
|
+
require('../modules/es.data-view.set-float16');
|
|
63
65
|
require('../modules/es.array-buffer.detached');
|
|
64
66
|
require('../modules/es.array-buffer.transfer');
|
|
65
67
|
require('../modules/es.array-buffer.transfer-to-fixed-length');
|
|
@@ -101,6 +103,7 @@ require('../modules/es.math.clz32');
|
|
|
101
103
|
require('../modules/es.math.cosh');
|
|
102
104
|
require('../modules/es.math.expm1');
|
|
103
105
|
require('../modules/es.math.fround');
|
|
106
|
+
require('../modules/es.math.f16round');
|
|
104
107
|
require('../modules/es.math.hypot');
|
|
105
108
|
require('../modules/es.math.imul');
|
|
106
109
|
require('../modules/es.math.log10');
|
|
@@ -175,6 +178,7 @@ require('../modules/es.reflect.set');
|
|
|
175
178
|
require('../modules/es.reflect.set-prototype-of');
|
|
176
179
|
require('../modules/es.reflect.to-string-tag');
|
|
177
180
|
require('../modules/es.regexp.constructor');
|
|
181
|
+
require('../modules/es.regexp.escape');
|
|
178
182
|
require('../modules/es.regexp.dot-all');
|
|
179
183
|
require('../modules/es.regexp.exec');
|
|
180
184
|
require('../modules/es.regexp.flags');
|
package/es/math/index.js
CHANGED
|
@@ -7,6 +7,7 @@ require('../../modules/es.math.clz32');
|
|
|
7
7
|
require('../../modules/es.math.cosh');
|
|
8
8
|
require('../../modules/es.math.expm1');
|
|
9
9
|
require('../../modules/es.math.fround');
|
|
10
|
+
require('../../modules/es.math.f16round');
|
|
10
11
|
require('../../modules/es.math.hypot');
|
|
11
12
|
require('../../modules/es.math.imul');
|
|
12
13
|
require('../../modules/es.math.log10');
|
package/es/regexp/index.js
CHANGED
package/full/index.js
CHANGED
|
@@ -60,6 +60,8 @@ require('../modules/es.array-buffer.constructor');
|
|
|
60
60
|
require('../modules/es.array-buffer.is-view');
|
|
61
61
|
require('../modules/es.array-buffer.slice');
|
|
62
62
|
require('../modules/es.data-view');
|
|
63
|
+
require('../modules/es.data-view.get-float16');
|
|
64
|
+
require('../modules/es.data-view.set-float16');
|
|
63
65
|
require('../modules/es.array-buffer.detached');
|
|
64
66
|
require('../modules/es.array-buffer.transfer');
|
|
65
67
|
require('../modules/es.array-buffer.transfer-to-fixed-length');
|
|
@@ -101,6 +103,7 @@ require('../modules/es.math.clz32');
|
|
|
101
103
|
require('../modules/es.math.cosh');
|
|
102
104
|
require('../modules/es.math.expm1');
|
|
103
105
|
require('../modules/es.math.fround');
|
|
106
|
+
require('../modules/es.math.f16round');
|
|
104
107
|
require('../modules/es.math.hypot');
|
|
105
108
|
require('../modules/es.math.imul');
|
|
106
109
|
require('../modules/es.math.log10');
|
|
@@ -175,6 +178,7 @@ require('../modules/es.reflect.set');
|
|
|
175
178
|
require('../modules/es.reflect.set-prototype-of');
|
|
176
179
|
require('../modules/es.reflect.to-string-tag');
|
|
177
180
|
require('../modules/es.regexp.constructor');
|
|
181
|
+
require('../modules/es.regexp.escape');
|
|
178
182
|
require('../modules/es.regexp.dot-all');
|
|
179
183
|
require('../modules/es.regexp.exec');
|
|
180
184
|
require('../modules/es.regexp.flags');
|
|
@@ -316,6 +320,7 @@ require('../modules/esnext.data-view.get-uint8-clamped');
|
|
|
316
320
|
require('../modules/esnext.data-view.set-float16');
|
|
317
321
|
require('../modules/esnext.data-view.set-uint8-clamped');
|
|
318
322
|
require('../modules/esnext.disposable-stack.constructor');
|
|
323
|
+
require('../modules/esnext.error.is-error');
|
|
319
324
|
require('../modules/esnext.function.demethodize');
|
|
320
325
|
require('../modules/esnext.function.is-callable');
|
|
321
326
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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.
|
|
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
|
+
};
|
package/internals/math-scale.js
CHANGED
|
@@ -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 =
|
|
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
|
-
|
|
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.
|
|
10
|
+
version: '3.41.0',
|
|
11
11
|
mode: IS_PURE ? 'pure' : 'global',
|
|
12
|
-
copyright: '© 2014-
|
|
13
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.
|
|
12
|
+
copyright: '© 2014-2025 Denis Pushkarev (zloirock.ru)',
|
|
13
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.41.0/LICENSE',
|
|
14
14
|
source: 'https://github.com/zloirock/core-js'
|
|
15
15
|
});
|
|
@@ -0,0 +1,31 @@
|
|
|
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://tc39.es/ecma262/#sec-dataview.prototype.getfloat16
|
|
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
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
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://tc39.es/ecma262/#sec-dataview.prototype.setfloat16
|
|
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
|
+
});
|
|
@@ -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
|
+
});
|
package/modules/es.math.log2.js
CHANGED
|
@@ -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:
|
|
11
|
-
return log(x) / LN2;
|
|
12
|
-
}
|
|
8
|
+
log2: log2
|
|
13
9
|
});
|
|
@@ -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
|
+
});
|
|
@@ -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:
|
|
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'
|
|
8
|
-
|
|
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:
|
|
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:
|
|
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:
|
|
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 () {
|
|
@@ -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
|
-
|
|
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
|
});
|
|
@@ -74,7 +74,7 @@ var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise) {
|
|
|
74
74
|
});
|
|
75
75
|
});
|
|
76
76
|
|
|
77
|
-
// `AsyncIterator.prototype.
|
|
77
|
+
// `AsyncIterator.prototype.flatMap` method
|
|
78
78
|
// https://github.com/tc39/proposal-async-iterator-helpers
|
|
79
79
|
$({ target: 'AsyncIterator', proto: true, real: true, forced: IS_PURE }, {
|
|
80
80
|
flatMap: function flatMap(mapper) {
|
|
@@ -1,16 +1,3 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var unpackIEEE754 = require('../internals/ieee754').unpack;
|
|
5
|
-
|
|
6
|
-
// eslint-disable-next-line es/no-typed-arrays -- safe
|
|
7
|
-
var getUint16 = uncurryThis(DataView.prototype.getUint16);
|
|
8
|
-
|
|
9
|
-
// `DataView.prototype.getFloat16` method
|
|
10
|
-
// https://github.com/tc39/proposal-float16array
|
|
11
|
-
$({ target: 'DataView', proto: true }, {
|
|
12
|
-
getFloat16: function getFloat16(byteOffset /* , littleEndian */) {
|
|
13
|
-
var uint16 = getUint16(this, byteOffset, arguments.length > 1 ? arguments[1] : false);
|
|
14
|
-
return unpackIEEE754([uint16 & 0xFF, uint16 >> 8 & 0xFF], 10);
|
|
15
|
-
}
|
|
16
|
-
});
|
|
2
|
+
// TODO: Remove from `core-js@4`
|
|
3
|
+
require('../modules/es.data-view.get-float16');
|
|
@@ -1,21 +1,3 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var aDataView = require('../internals/a-data-view');
|
|
5
|
-
var toIndex = require('../internals/to-index');
|
|
6
|
-
var packIEEE754 = require('../internals/ieee754').pack;
|
|
7
|
-
var f16round = require('../internals/math-f16round');
|
|
8
|
-
|
|
9
|
-
// eslint-disable-next-line es/no-typed-arrays -- safe
|
|
10
|
-
var setUint16 = uncurryThis(DataView.prototype.setUint16);
|
|
11
|
-
|
|
12
|
-
// `DataView.prototype.setFloat16` method
|
|
13
|
-
// https://github.com/tc39/proposal-float16array
|
|
14
|
-
$({ target: 'DataView', proto: true }, {
|
|
15
|
-
setFloat16: function setFloat16(byteOffset, value /* , littleEndian */) {
|
|
16
|
-
aDataView(this);
|
|
17
|
-
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);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
2
|
+
// TODO: Remove from `core-js@4`
|
|
3
|
+
require('../modules/es.data-view.set-float16');
|
|
@@ -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
|
|
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,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
|
|
5
|
-
var
|
|
7
|
+
var $RangeError = RangeError;
|
|
8
|
+
var $min = Math.min;
|
|
9
|
+
var $max = Math.max;
|
|
6
10
|
|
|
7
11
|
// `Math.clamp` method
|
|
8
|
-
// https://
|
|
12
|
+
// https://github.com/tc39/proposal-math-clamp
|
|
9
13
|
$({ target: 'Math', stat: true, forced: true }, {
|
|
10
|
-
clamp: function clamp(
|
|
11
|
-
|
|
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
|
});
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
// `Math.f16round` method
|
|
6
|
-
// https://github.com/tc39/proposal-float16array
|
|
7
|
-
$({ target: 'Math', stat: true }, { f16round: f16round });
|
|
2
|
+
// TODO: Remove from `core-js@4`
|
|
3
|
+
require('../modules/es.math.f16round');
|
|
@@ -1,70 +1,3 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
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://github.com/tc39/proposal-regex-escaping
|
|
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
|
-
});
|
|
2
|
+
// TODO: Remove from `core-js@4`
|
|
3
|
+
require('../modules/es.regexp.escape.js');
|
|
@@ -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
|
-
},
|
|
52
|
+
}, true);
|
package/package.json
CHANGED
package/stable/index.js
CHANGED
|
@@ -60,6 +60,8 @@ require('../modules/es.array-buffer.constructor');
|
|
|
60
60
|
require('../modules/es.array-buffer.is-view');
|
|
61
61
|
require('../modules/es.array-buffer.slice');
|
|
62
62
|
require('../modules/es.data-view');
|
|
63
|
+
require('../modules/es.data-view.get-float16');
|
|
64
|
+
require('../modules/es.data-view.set-float16');
|
|
63
65
|
require('../modules/es.array-buffer.detached');
|
|
64
66
|
require('../modules/es.array-buffer.transfer');
|
|
65
67
|
require('../modules/es.array-buffer.transfer-to-fixed-length');
|
|
@@ -101,6 +103,7 @@ require('../modules/es.math.clz32');
|
|
|
101
103
|
require('../modules/es.math.cosh');
|
|
102
104
|
require('../modules/es.math.expm1');
|
|
103
105
|
require('../modules/es.math.fround');
|
|
106
|
+
require('../modules/es.math.f16round');
|
|
104
107
|
require('../modules/es.math.hypot');
|
|
105
108
|
require('../modules/es.math.imul');
|
|
106
109
|
require('../modules/es.math.log10');
|
|
@@ -175,6 +178,7 @@ require('../modules/es.reflect.set');
|
|
|
175
178
|
require('../modules/es.reflect.set-prototype-of');
|
|
176
179
|
require('../modules/es.reflect.to-string-tag');
|
|
177
180
|
require('../modules/es.regexp.constructor');
|
|
181
|
+
require('../modules/es.regexp.escape');
|
|
178
182
|
require('../modules/es.regexp.dot-all');
|
|
179
183
|
require('../modules/es.regexp.exec');
|
|
180
184
|
require('../modules/es.regexp.flags');
|
package/stage/1.js
CHANGED
|
@@ -8,6 +8,7 @@ require('../proposals/collection-methods');
|
|
|
8
8
|
require('../proposals/collection-of-from');
|
|
9
9
|
require('../proposals/data-view-get-set-uint8-clamped');
|
|
10
10
|
require('../proposals/keys-composition');
|
|
11
|
+
require('../proposals/math-clamp');
|
|
11
12
|
require('../proposals/math-extensions');
|
|
12
13
|
require('../proposals/math-signbit');
|
|
13
14
|
require('../proposals/number-from-string');
|
package/stage/3.js
CHANGED
|
@@ -5,10 +5,9 @@ require('../proposals/array-buffer-base64');
|
|
|
5
5
|
require('../proposals/array-from-async-stage-2');
|
|
6
6
|
require('../proposals/decorator-metadata-v2');
|
|
7
7
|
require('../proposals/explicit-resource-management');
|
|
8
|
-
require('../proposals/
|
|
8
|
+
require('../proposals/is-error');
|
|
9
9
|
require('../proposals/json-parse-with-source');
|
|
10
10
|
require('../proposals/math-sum');
|
|
11
|
-
require('../proposals/regexp-escaping');
|
|
12
11
|
// TODO: Obsolete versions, remove from `core-js@4`
|
|
13
12
|
require('../proposals/array-grouping-stage-3');
|
|
14
13
|
require('../proposals/array-grouping-stage-3-2');
|
package/stage/4.js
CHANGED
|
@@ -6,12 +6,14 @@ require('../proposals/array-find-from-last');
|
|
|
6
6
|
require('../proposals/array-grouping-v2');
|
|
7
7
|
require('../proposals/change-array-by-copy-stage-4');
|
|
8
8
|
// require('../proposals/error-cause');
|
|
9
|
+
require('../proposals/float16');
|
|
9
10
|
require('../proposals/global-this');
|
|
10
11
|
require('../proposals/iterator-helpers-stage-3-2');
|
|
11
12
|
require('../proposals/promise-all-settled');
|
|
12
13
|
require('../proposals/promise-any');
|
|
13
14
|
require('../proposals/promise-try');
|
|
14
15
|
require('../proposals/promise-with-resolvers');
|
|
16
|
+
require('../proposals/regexp-escaping');
|
|
15
17
|
require('../proposals/relative-indexing-method');
|
|
16
18
|
require('../proposals/set-methods-v2');
|
|
17
19
|
require('../proposals/string-match-all');
|
|
@@ -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
|
-
};
|