core-js-pure 3.40.0 → 3.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actual/data-view/get-float16.js +3 -0
- package/actual/data-view/set-float16.js +3 -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/full/index.js +4 -0
- package/internals/a-number.js +7 -0
- package/internals/a-weak-key.js +12 -0
- package/internals/async-from-sync-iterator.js +15 -4
- package/internals/iterator-helper-without-closing-on-early-error.js +23 -0
- package/internals/iterator-indexed.js +2 -1
- package/internals/shared-store.js +2 -2
- package/modules/es.data-view.get-float16.js +1 -0
- package/modules/es.data-view.set-float16.js +1 -0
- package/modules/es.iterator.drop.js +14 -2
- package/modules/es.iterator.every.js +14 -2
- package/modules/es.iterator.filter.js +13 -2
- package/modules/es.iterator.find.js +14 -2
- package/modules/es.iterator.flat-map.js +12 -2
- package/modules/es.iterator.for-each.js +14 -2
- package/modules/es.iterator.map.js +32 -3
- package/modules/es.iterator.reduce.js +23 -3
- package/modules/es.iterator.some.js +14 -2
- package/modules/es.iterator.take.js +13 -2
- package/modules/es.map.group-by.js +1 -0
- package/modules/es.math.f16round.js +15 -0
- package/modules/es.object.group-by.js +1 -0
- package/modules/es.regexp.escape.js +70 -0
- package/modules/es.string.match-all.js +2 -2
- package/modules/es.string.replace-all.js +2 -2
- package/modules/esnext.async-disposable-stack.constructor.js +6 -1
- package/modules/esnext.async-iterator.drop.js +1 -2
- package/modules/esnext.async-iterator.every.js +1 -1
- package/modules/esnext.async-iterator.filter.js +1 -2
- package/modules/esnext.async-iterator.find.js +1 -1
- package/modules/esnext.async-iterator.flat-map.js +2 -3
- package/modules/esnext.async-iterator.for-each.js +1 -1
- package/modules/esnext.async-iterator.from.js +1 -2
- package/modules/esnext.async-iterator.map.js +1 -2
- package/modules/esnext.async-iterator.reduce.js +1 -1
- package/modules/esnext.async-iterator.some.js +1 -1
- package/modules/esnext.async-iterator.take.js +1 -2
- package/modules/esnext.async-iterator.to-array.js +1 -1
- package/modules/esnext.iterator.to-async.js +1 -2
- package/modules/esnext.json.is-raw-json.js +1 -1
- package/modules/esnext.json.raw-json.js +2 -2
- package/modules/esnext.math.clamp.js +13 -5
- package/modules/esnext.math.f16round.js +2 -14
- package/modules/esnext.regexp.escape.js +2 -70
- package/modules/esnext.weak-map.get-or-insert-computed.js +2 -1
- package/package.json +1 -1
- 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/2.7.js +1 -0
- package/stage/2.js +0 -1
- package/stage/3.js +0 -2
- package/stage/4.js +2 -0
- package/internals/iterator-map.js +0 -24
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');
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var WeakMapHelpers = require('../internals/weak-map-helpers');
|
|
3
|
+
|
|
4
|
+
var weakmap = new WeakMapHelpers.WeakMap();
|
|
5
|
+
var set = WeakMapHelpers.set;
|
|
6
|
+
var remove = WeakMapHelpers.remove;
|
|
7
|
+
|
|
8
|
+
module.exports = function (key) {
|
|
9
|
+
set(weakmap, key, 1);
|
|
10
|
+
remove(weakmap, key);
|
|
11
|
+
return key;
|
|
12
|
+
};
|
|
@@ -5,6 +5,7 @@ var create = require('../internals/object-create');
|
|
|
5
5
|
var getMethod = require('../internals/get-method');
|
|
6
6
|
var defineBuiltIns = require('../internals/define-built-ins');
|
|
7
7
|
var InternalStateModule = require('../internals/internal-state');
|
|
8
|
+
var iteratorClose = require('../internals/iterator-close');
|
|
8
9
|
var getBuiltIn = require('../internals/get-built-in');
|
|
9
10
|
var AsyncIteratorPrototype = require('../internals/async-iterator-prototype');
|
|
10
11
|
var createIterResultObject = require('../internals/create-iter-result-object');
|
|
@@ -15,11 +16,21 @@ var ASYNC_FROM_SYNC_ITERATOR = 'AsyncFromSyncIterator';
|
|
|
15
16
|
var setInternalState = InternalStateModule.set;
|
|
16
17
|
var getInternalState = InternalStateModule.getterFor(ASYNC_FROM_SYNC_ITERATOR);
|
|
17
18
|
|
|
18
|
-
var asyncFromSyncIteratorContinuation = function (result, resolve, reject) {
|
|
19
|
+
var asyncFromSyncIteratorContinuation = function (result, resolve, reject, syncIterator, closeOnRejection) {
|
|
19
20
|
var done = result.done;
|
|
20
21
|
Promise.resolve(result.value).then(function (value) {
|
|
21
22
|
resolve(createIterResultObject(value, done));
|
|
22
|
-
},
|
|
23
|
+
}, function (error) {
|
|
24
|
+
if (!done && closeOnRejection) {
|
|
25
|
+
try {
|
|
26
|
+
iteratorClose(syncIterator, 'throw', error);
|
|
27
|
+
} catch (error2) {
|
|
28
|
+
error = error2;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
reject(error);
|
|
33
|
+
});
|
|
23
34
|
};
|
|
24
35
|
|
|
25
36
|
var AsyncFromSyncIterator = function AsyncIterator(iteratorRecord) {
|
|
@@ -32,7 +43,7 @@ AsyncFromSyncIterator.prototype = defineBuiltIns(create(AsyncIteratorPrototype),
|
|
|
32
43
|
var state = getInternalState(this);
|
|
33
44
|
return new Promise(function (resolve, reject) {
|
|
34
45
|
var result = anObject(call(state.next, state.iterator));
|
|
35
|
-
asyncFromSyncIteratorContinuation(result, resolve, reject);
|
|
46
|
+
asyncFromSyncIteratorContinuation(result, resolve, reject, state.iterator, true);
|
|
36
47
|
});
|
|
37
48
|
},
|
|
38
49
|
'return': function () {
|
|
@@ -41,7 +52,7 @@ AsyncFromSyncIterator.prototype = defineBuiltIns(create(AsyncIteratorPrototype),
|
|
|
41
52
|
var $return = getMethod(iterator, 'return');
|
|
42
53
|
if ($return === undefined) return resolve(createIterResultObject(undefined, true));
|
|
43
54
|
var result = anObject(call($return, iterator));
|
|
44
|
-
asyncFromSyncIteratorContinuation(result, resolve, reject);
|
|
55
|
+
asyncFromSyncIteratorContinuation(result, resolve, reject, iterator);
|
|
45
56
|
});
|
|
46
57
|
}
|
|
47
58
|
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var globalThis = require('../internals/global-this');
|
|
3
|
+
|
|
4
|
+
// https://github.com/tc39/ecma262/pull/3467
|
|
5
|
+
module.exports = function (METHOD_NAME, ExpectedError) {
|
|
6
|
+
var Iterator = globalThis.Iterator;
|
|
7
|
+
var IteratorPrototype = Iterator && Iterator.prototype;
|
|
8
|
+
var method = IteratorPrototype && IteratorPrototype[METHOD_NAME];
|
|
9
|
+
|
|
10
|
+
var CLOSED = false;
|
|
11
|
+
|
|
12
|
+
if (method) try {
|
|
13
|
+
method.call({
|
|
14
|
+
next: function () { return { done: true }; },
|
|
15
|
+
'return': function () { CLOSED = true; }
|
|
16
|
+
}, -1);
|
|
17
|
+
} catch (error) {
|
|
18
|
+
// https://bugs.webkit.org/show_bug.cgi?id=291195
|
|
19
|
+
if (!(error instanceof ExpectedError)) CLOSED = false;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (!CLOSED) return method;
|
|
23
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
+
require('../modules/es.iterator.map');
|
|
2
3
|
var call = require('../internals/function-call');
|
|
3
|
-
var map = require('../internals/
|
|
4
|
+
var map = require('../internals/iterators-core').IteratorPrototype.map;
|
|
4
5
|
|
|
5
6
|
var callback = function (value, counter) {
|
|
6
7
|
return [counter, value];
|
|
@@ -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.42.0',
|
|
11
11
|
mode: IS_PURE ? 'pure' : 'global',
|
|
12
12
|
copyright: '© 2014-2025 Denis Pushkarev (zloirock.ru)',
|
|
13
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.
|
|
13
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.42.0/LICENSE',
|
|
14
14
|
source: 'https://github.com/zloirock/core-js'
|
|
15
15
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// empty
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// empty
|
|
@@ -5,9 +5,13 @@ var anObject = require('../internals/an-object');
|
|
|
5
5
|
var getIteratorDirect = require('../internals/get-iterator-direct');
|
|
6
6
|
var notANaN = require('../internals/not-a-nan');
|
|
7
7
|
var toPositiveInteger = require('../internals/to-positive-integer');
|
|
8
|
+
var iteratorClose = require('../internals/iterator-close');
|
|
8
9
|
var createIteratorProxy = require('../internals/iterator-create-proxy');
|
|
10
|
+
var iteratorHelperWithoutClosingOnEarlyError = require('../internals/iterator-helper-without-closing-on-early-error');
|
|
9
11
|
var IS_PURE = require('../internals/is-pure');
|
|
10
12
|
|
|
13
|
+
var dropWithoutClosingOnEarlyError = !IS_PURE && iteratorHelperWithoutClosingOnEarlyError('drop', RangeError);
|
|
14
|
+
|
|
11
15
|
var IteratorProxy = createIteratorProxy(function () {
|
|
12
16
|
var iterator = this.iterator;
|
|
13
17
|
var next = this.next;
|
|
@@ -25,10 +29,18 @@ var IteratorProxy = createIteratorProxy(function () {
|
|
|
25
29
|
|
|
26
30
|
// `Iterator.prototype.drop` method
|
|
27
31
|
// https://tc39.es/ecma262/#sec-iterator.prototype.drop
|
|
28
|
-
$({ target: 'Iterator', proto: true, real: true, forced: IS_PURE }, {
|
|
32
|
+
$({ target: 'Iterator', proto: true, real: true, forced: IS_PURE || dropWithoutClosingOnEarlyError }, {
|
|
29
33
|
drop: function drop(limit) {
|
|
30
34
|
anObject(this);
|
|
31
|
-
var remaining
|
|
35
|
+
var remaining;
|
|
36
|
+
try {
|
|
37
|
+
remaining = toPositiveInteger(notANaN(+limit));
|
|
38
|
+
} catch (error) {
|
|
39
|
+
iteratorClose(this, 'throw', error);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (dropWithoutClosingOnEarlyError) return call(dropWithoutClosingOnEarlyError, this, remaining);
|
|
43
|
+
|
|
32
44
|
return new IteratorProxy(getIteratorDirect(this), {
|
|
33
45
|
remaining: remaining
|
|
34
46
|
});
|
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
var $ = require('../internals/export');
|
|
3
|
+
var call = require('../internals/function-call');
|
|
3
4
|
var iterate = require('../internals/iterate');
|
|
4
5
|
var aCallable = require('../internals/a-callable');
|
|
5
6
|
var anObject = require('../internals/an-object');
|
|
6
7
|
var getIteratorDirect = require('../internals/get-iterator-direct');
|
|
8
|
+
var iteratorClose = require('../internals/iterator-close');
|
|
9
|
+
var iteratorHelperWithoutClosingOnEarlyError = require('../internals/iterator-helper-without-closing-on-early-error');
|
|
10
|
+
|
|
11
|
+
var everyWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError('every', TypeError);
|
|
7
12
|
|
|
8
13
|
// `Iterator.prototype.every` method
|
|
9
14
|
// https://tc39.es/ecma262/#sec-iterator.prototype.every
|
|
10
|
-
$({ target: 'Iterator', proto: true, real: true }, {
|
|
15
|
+
$({ target: 'Iterator', proto: true, real: true, forced: everyWithoutClosingOnEarlyError }, {
|
|
11
16
|
every: function every(predicate) {
|
|
12
17
|
anObject(this);
|
|
13
|
-
|
|
18
|
+
try {
|
|
19
|
+
aCallable(predicate);
|
|
20
|
+
} catch (error) {
|
|
21
|
+
iteratorClose(this, 'throw', error);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (everyWithoutClosingOnEarlyError) return call(everyWithoutClosingOnEarlyError, this, predicate);
|
|
25
|
+
|
|
14
26
|
var record = getIteratorDirect(this);
|
|
15
27
|
var counter = 0;
|
|
16
28
|
return !iterate(record, function (value, stop) {
|
|
@@ -7,6 +7,10 @@ var getIteratorDirect = require('../internals/get-iterator-direct');
|
|
|
7
7
|
var createIteratorProxy = require('../internals/iterator-create-proxy');
|
|
8
8
|
var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing');
|
|
9
9
|
var IS_PURE = require('../internals/is-pure');
|
|
10
|
+
var iteratorClose = require('../internals/iterator-close');
|
|
11
|
+
var iteratorHelperWithoutClosingOnEarlyError = require('../internals/iterator-helper-without-closing-on-early-error');
|
|
12
|
+
|
|
13
|
+
var filterWithoutClosingOnEarlyError = !IS_PURE && iteratorHelperWithoutClosingOnEarlyError('filter', TypeError);
|
|
10
14
|
|
|
11
15
|
var IteratorProxy = createIteratorProxy(function () {
|
|
12
16
|
var iterator = this.iterator;
|
|
@@ -24,10 +28,17 @@ var IteratorProxy = createIteratorProxy(function () {
|
|
|
24
28
|
|
|
25
29
|
// `Iterator.prototype.filter` method
|
|
26
30
|
// https://tc39.es/ecma262/#sec-iterator.prototype.filter
|
|
27
|
-
$({ target: 'Iterator', proto: true, real: true, forced: IS_PURE }, {
|
|
31
|
+
$({ target: 'Iterator', proto: true, real: true, forced: IS_PURE || filterWithoutClosingOnEarlyError }, {
|
|
28
32
|
filter: function filter(predicate) {
|
|
29
33
|
anObject(this);
|
|
30
|
-
|
|
34
|
+
try {
|
|
35
|
+
aCallable(predicate);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
iteratorClose(this, 'throw', error);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (filterWithoutClosingOnEarlyError) return call(filterWithoutClosingOnEarlyError, this, predicate);
|
|
41
|
+
|
|
31
42
|
return new IteratorProxy(getIteratorDirect(this), {
|
|
32
43
|
predicate: predicate
|
|
33
44
|
});
|
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
var $ = require('../internals/export');
|
|
3
|
+
var call = require('../internals/function-call');
|
|
3
4
|
var iterate = require('../internals/iterate');
|
|
4
5
|
var aCallable = require('../internals/a-callable');
|
|
5
6
|
var anObject = require('../internals/an-object');
|
|
6
7
|
var getIteratorDirect = require('../internals/get-iterator-direct');
|
|
8
|
+
var iteratorClose = require('../internals/iterator-close');
|
|
9
|
+
var iteratorHelperWithoutClosingOnEarlyError = require('../internals/iterator-helper-without-closing-on-early-error');
|
|
10
|
+
|
|
11
|
+
var findWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError('find', TypeError);
|
|
7
12
|
|
|
8
13
|
// `Iterator.prototype.find` method
|
|
9
14
|
// https://tc39.es/ecma262/#sec-iterator.prototype.find
|
|
10
|
-
$({ target: 'Iterator', proto: true, real: true }, {
|
|
15
|
+
$({ target: 'Iterator', proto: true, real: true, forced: findWithoutClosingOnEarlyError }, {
|
|
11
16
|
find: function find(predicate) {
|
|
12
17
|
anObject(this);
|
|
13
|
-
|
|
18
|
+
try {
|
|
19
|
+
aCallable(predicate);
|
|
20
|
+
} catch (error) {
|
|
21
|
+
iteratorClose(this, 'throw', error);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (findWithoutClosingOnEarlyError) return call(findWithoutClosingOnEarlyError, this, predicate);
|
|
25
|
+
|
|
14
26
|
var record = getIteratorDirect(this);
|
|
15
27
|
var counter = 0;
|
|
16
28
|
return iterate(record, function (value, stop) {
|
|
@@ -8,6 +8,9 @@ var getIteratorFlattenable = require('../internals/get-iterator-flattenable');
|
|
|
8
8
|
var createIteratorProxy = require('../internals/iterator-create-proxy');
|
|
9
9
|
var iteratorClose = require('../internals/iterator-close');
|
|
10
10
|
var IS_PURE = require('../internals/is-pure');
|
|
11
|
+
var iteratorHelperWithoutClosingOnEarlyError = require('../internals/iterator-helper-without-closing-on-early-error');
|
|
12
|
+
|
|
13
|
+
var flatMapWithoutClosingOnEarlyError = !IS_PURE && iteratorHelperWithoutClosingOnEarlyError('flatMap', TypeError);
|
|
11
14
|
|
|
12
15
|
var IteratorProxy = createIteratorProxy(function () {
|
|
13
16
|
var iterator = this.iterator;
|
|
@@ -33,10 +36,17 @@ var IteratorProxy = createIteratorProxy(function () {
|
|
|
33
36
|
|
|
34
37
|
// `Iterator.prototype.flatMap` method
|
|
35
38
|
// https://tc39.es/ecma262/#sec-iterator.prototype.flatmap
|
|
36
|
-
$({ target: 'Iterator', proto: true, real: true, forced: IS_PURE }, {
|
|
39
|
+
$({ target: 'Iterator', proto: true, real: true, forced: IS_PURE || flatMapWithoutClosingOnEarlyError }, {
|
|
37
40
|
flatMap: function flatMap(mapper) {
|
|
38
41
|
anObject(this);
|
|
39
|
-
|
|
42
|
+
try {
|
|
43
|
+
aCallable(mapper);
|
|
44
|
+
} catch (error) {
|
|
45
|
+
iteratorClose(this, 'throw', error);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (flatMapWithoutClosingOnEarlyError) return call(flatMapWithoutClosingOnEarlyError, this, mapper);
|
|
49
|
+
|
|
40
50
|
return new IteratorProxy(getIteratorDirect(this), {
|
|
41
51
|
mapper: mapper,
|
|
42
52
|
inner: null
|
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
var $ = require('../internals/export');
|
|
3
|
+
var call = require('../internals/function-call');
|
|
3
4
|
var iterate = require('../internals/iterate');
|
|
4
5
|
var aCallable = require('../internals/a-callable');
|
|
5
6
|
var anObject = require('../internals/an-object');
|
|
6
7
|
var getIteratorDirect = require('../internals/get-iterator-direct');
|
|
8
|
+
var iteratorClose = require('../internals/iterator-close');
|
|
9
|
+
var iteratorHelperWithoutClosingOnEarlyError = require('../internals/iterator-helper-without-closing-on-early-error');
|
|
10
|
+
|
|
11
|
+
var forEachWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError('forEach', TypeError);
|
|
7
12
|
|
|
8
13
|
// `Iterator.prototype.forEach` method
|
|
9
14
|
// https://tc39.es/ecma262/#sec-iterator.prototype.foreach
|
|
10
|
-
$({ target: 'Iterator', proto: true, real: true }, {
|
|
15
|
+
$({ target: 'Iterator', proto: true, real: true, forced: forEachWithoutClosingOnEarlyError }, {
|
|
11
16
|
forEach: function forEach(fn) {
|
|
12
17
|
anObject(this);
|
|
13
|
-
|
|
18
|
+
try {
|
|
19
|
+
aCallable(fn);
|
|
20
|
+
} catch (error) {
|
|
21
|
+
iteratorClose(this, 'throw', error);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (forEachWithoutClosingOnEarlyError) return call(forEachWithoutClosingOnEarlyError, this, fn);
|
|
25
|
+
|
|
14
26
|
var record = getIteratorDirect(this);
|
|
15
27
|
var counter = 0;
|
|
16
28
|
iterate(record, function (value) {
|
|
@@ -1,10 +1,39 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
var $ = require('../internals/export');
|
|
3
|
-
var
|
|
3
|
+
var call = require('../internals/function-call');
|
|
4
|
+
var aCallable = require('../internals/a-callable');
|
|
5
|
+
var anObject = require('../internals/an-object');
|
|
6
|
+
var getIteratorDirect = require('../internals/get-iterator-direct');
|
|
7
|
+
var createIteratorProxy = require('../internals/iterator-create-proxy');
|
|
8
|
+
var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing');
|
|
9
|
+
var iteratorClose = require('../internals/iterator-close');
|
|
10
|
+
var iteratorHelperWithoutClosingOnEarlyError = require('../internals/iterator-helper-without-closing-on-early-error');
|
|
4
11
|
var IS_PURE = require('../internals/is-pure');
|
|
5
12
|
|
|
13
|
+
var mapWithoutClosingOnEarlyError = !IS_PURE && iteratorHelperWithoutClosingOnEarlyError('map', TypeError);
|
|
14
|
+
|
|
15
|
+
var IteratorProxy = createIteratorProxy(function () {
|
|
16
|
+
var iterator = this.iterator;
|
|
17
|
+
var result = anObject(call(this.next, iterator));
|
|
18
|
+
var done = this.done = !!result.done;
|
|
19
|
+
if (!done) return callWithSafeIterationClosing(iterator, this.mapper, [result.value, this.counter++], true);
|
|
20
|
+
});
|
|
21
|
+
|
|
6
22
|
// `Iterator.prototype.map` method
|
|
7
23
|
// https://tc39.es/ecma262/#sec-iterator.prototype.map
|
|
8
|
-
$({ target: 'Iterator', proto: true, real: true, forced: IS_PURE }, {
|
|
9
|
-
map: map
|
|
24
|
+
$({ target: 'Iterator', proto: true, real: true, forced: IS_PURE || mapWithoutClosingOnEarlyError }, {
|
|
25
|
+
map: function map(mapper) {
|
|
26
|
+
anObject(this);
|
|
27
|
+
try {
|
|
28
|
+
aCallable(mapper);
|
|
29
|
+
} catch (error) {
|
|
30
|
+
iteratorClose(this, 'throw', error);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (mapWithoutClosingOnEarlyError) return call(mapWithoutClosingOnEarlyError, this, mapper);
|
|
34
|
+
|
|
35
|
+
return new IteratorProxy(getIteratorDirect(this), {
|
|
36
|
+
mapper: mapper
|
|
37
|
+
});
|
|
38
|
+
}
|
|
10
39
|
});
|
|
@@ -4,18 +4,38 @@ var iterate = require('../internals/iterate');
|
|
|
4
4
|
var aCallable = require('../internals/a-callable');
|
|
5
5
|
var anObject = require('../internals/an-object');
|
|
6
6
|
var getIteratorDirect = require('../internals/get-iterator-direct');
|
|
7
|
+
var iteratorClose = require('../internals/iterator-close');
|
|
8
|
+
var iteratorHelperWithoutClosingOnEarlyError = require('../internals/iterator-helper-without-closing-on-early-error');
|
|
9
|
+
var apply = require('../internals/function-apply');
|
|
10
|
+
var fails = require('../internals/fails');
|
|
7
11
|
|
|
8
12
|
var $TypeError = TypeError;
|
|
9
13
|
|
|
14
|
+
// https://bugs.webkit.org/show_bug.cgi?id=291651
|
|
15
|
+
var FAILS_ON_INITIAL_UNDEFINED = fails(function () {
|
|
16
|
+
// eslint-disable-next-line es/no-iterator-prototype-reduce, es/no-array-prototype-keys, array-callback-return -- required for testing
|
|
17
|
+
[].keys().reduce(function () { /* empty */ }, undefined);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
var reduceWithoutClosingOnEarlyError = !FAILS_ON_INITIAL_UNDEFINED && iteratorHelperWithoutClosingOnEarlyError('reduce', $TypeError);
|
|
21
|
+
|
|
10
22
|
// `Iterator.prototype.reduce` method
|
|
11
23
|
// https://tc39.es/ecma262/#sec-iterator.prototype.reduce
|
|
12
|
-
$({ target: 'Iterator', proto: true, real: true }, {
|
|
24
|
+
$({ target: 'Iterator', proto: true, real: true, forced: FAILS_ON_INITIAL_UNDEFINED || reduceWithoutClosingOnEarlyError }, {
|
|
13
25
|
reduce: function reduce(reducer /* , initialValue */) {
|
|
14
26
|
anObject(this);
|
|
15
|
-
|
|
16
|
-
|
|
27
|
+
try {
|
|
28
|
+
aCallable(reducer);
|
|
29
|
+
} catch (error) {
|
|
30
|
+
iteratorClose(this, 'throw', error);
|
|
31
|
+
}
|
|
32
|
+
|
|
17
33
|
var noInitial = arguments.length < 2;
|
|
18
34
|
var accumulator = noInitial ? undefined : arguments[1];
|
|
35
|
+
if (reduceWithoutClosingOnEarlyError) {
|
|
36
|
+
return apply(reduceWithoutClosingOnEarlyError, this, noInitial ? [reducer] : [reducer, accumulator]);
|
|
37
|
+
}
|
|
38
|
+
var record = getIteratorDirect(this);
|
|
19
39
|
var counter = 0;
|
|
20
40
|
iterate(record, function (value) {
|
|
21
41
|
if (noInitial) {
|
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
var $ = require('../internals/export');
|
|
3
|
+
var call = require('../internals/function-call');
|
|
3
4
|
var iterate = require('../internals/iterate');
|
|
4
5
|
var aCallable = require('../internals/a-callable');
|
|
5
6
|
var anObject = require('../internals/an-object');
|
|
6
7
|
var getIteratorDirect = require('../internals/get-iterator-direct');
|
|
8
|
+
var iteratorClose = require('../internals/iterator-close');
|
|
9
|
+
var iteratorHelperWithoutClosingOnEarlyError = require('../internals/iterator-helper-without-closing-on-early-error');
|
|
10
|
+
|
|
11
|
+
var someWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError('some', TypeError);
|
|
7
12
|
|
|
8
13
|
// `Iterator.prototype.some` method
|
|
9
14
|
// https://tc39.es/ecma262/#sec-iterator.prototype.some
|
|
10
|
-
$({ target: 'Iterator', proto: true, real: true }, {
|
|
15
|
+
$({ target: 'Iterator', proto: true, real: true, forced: someWithoutClosingOnEarlyError }, {
|
|
11
16
|
some: function some(predicate) {
|
|
12
17
|
anObject(this);
|
|
13
|
-
|
|
18
|
+
try {
|
|
19
|
+
aCallable(predicate);
|
|
20
|
+
} catch (error) {
|
|
21
|
+
iteratorClose(this, 'throw', error);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (someWithoutClosingOnEarlyError) return call(someWithoutClosingOnEarlyError, this, predicate);
|
|
25
|
+
|
|
14
26
|
var record = getIteratorDirect(this);
|
|
15
27
|
var counter = 0;
|
|
16
28
|
return iterate(record, function (value, stop) {
|
|
@@ -7,8 +7,11 @@ var notANaN = require('../internals/not-a-nan');
|
|
|
7
7
|
var toPositiveInteger = require('../internals/to-positive-integer');
|
|
8
8
|
var createIteratorProxy = require('../internals/iterator-create-proxy');
|
|
9
9
|
var iteratorClose = require('../internals/iterator-close');
|
|
10
|
+
var iteratorHelperWithoutClosingOnEarlyError = require('../internals/iterator-helper-without-closing-on-early-error');
|
|
10
11
|
var IS_PURE = require('../internals/is-pure');
|
|
11
12
|
|
|
13
|
+
var takeWithoutClosingOnEarlyError = !IS_PURE && iteratorHelperWithoutClosingOnEarlyError('take', RangeError);
|
|
14
|
+
|
|
12
15
|
var IteratorProxy = createIteratorProxy(function () {
|
|
13
16
|
var iterator = this.iterator;
|
|
14
17
|
if (!this.remaining--) {
|
|
@@ -22,10 +25,18 @@ var IteratorProxy = createIteratorProxy(function () {
|
|
|
22
25
|
|
|
23
26
|
// `Iterator.prototype.take` method
|
|
24
27
|
// https://tc39.es/ecma262/#sec-iterator.prototype.take
|
|
25
|
-
$({ target: 'Iterator', proto: true, real: true, forced: IS_PURE }, {
|
|
28
|
+
$({ target: 'Iterator', proto: true, real: true, forced: IS_PURE || takeWithoutClosingOnEarlyError }, {
|
|
26
29
|
take: function take(limit) {
|
|
27
30
|
anObject(this);
|
|
28
|
-
var remaining
|
|
31
|
+
var remaining;
|
|
32
|
+
try {
|
|
33
|
+
remaining = toPositiveInteger(notANaN(+limit));
|
|
34
|
+
} catch (error) {
|
|
35
|
+
iteratorClose(this, 'throw', error);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (takeWithoutClosingOnEarlyError) return call(takeWithoutClosingOnEarlyError, this, remaining);
|
|
39
|
+
|
|
29
40
|
return new IteratorProxy(getIteratorDirect(this), {
|
|
30
41
|
remaining: remaining
|
|
31
42
|
});
|
|
@@ -14,6 +14,7 @@ var get = MapHelpers.get;
|
|
|
14
14
|
var set = MapHelpers.set;
|
|
15
15
|
var push = uncurryThis([].push);
|
|
16
16
|
|
|
17
|
+
// https://bugs.webkit.org/show_bug.cgi?id=271524
|
|
17
18
|
var DOES_NOT_WORK_WITH_PRIMITIVES = IS_PURE || fails(function () {
|
|
18
19
|
return Map.groupBy('ab', function (it) {
|
|
19
20
|
return it;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var $ = require('../internals/export');
|
|
3
|
+
var floatRound = require('../internals/math-float-round');
|
|
4
|
+
|
|
5
|
+
var FLOAT16_EPSILON = 0.0009765625;
|
|
6
|
+
var FLOAT16_MAX_VALUE = 65504;
|
|
7
|
+
var FLOAT16_MIN_VALUE = 6.103515625e-05;
|
|
8
|
+
|
|
9
|
+
// `Math.f16round` method
|
|
10
|
+
// https://tc39.es/ecma262/#sec-math.f16round
|
|
11
|
+
$({ target: 'Math', stat: true }, {
|
|
12
|
+
f16round: function f16round(x) {
|
|
13
|
+
return floatRound(x, FLOAT16_EPSILON, FLOAT16_MAX_VALUE, FLOAT16_MIN_VALUE);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
@@ -13,6 +13,7 @@ var nativeGroupBy = Object.groupBy;
|
|
|
13
13
|
var create = getBuiltIn('Object', 'create');
|
|
14
14
|
var push = uncurryThis([].push);
|
|
15
15
|
|
|
16
|
+
// https://bugs.webkit.org/show_bug.cgi?id=271524
|
|
16
17
|
var DOES_NOT_WORK_WITH_PRIMITIVES = !nativeGroupBy || fails(function () {
|
|
17
18
|
return nativeGroupBy('ab', function (it) {
|
|
18
19
|
return it;
|