core-js 3.25.5 → 3.26.1
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/README.md +1 -1
- package/actual/array/from-async.js +8 -0
- package/actual/array/index.js +1 -0
- package/actual/self.js +3 -0
- package/features/instance/is-well-formed.js +1 -0
- package/features/instance/to-well-formed.js +1 -0
- package/features/self.js +1 -0
- package/features/string/is-well-formed.js +1 -0
- package/features/string/to-well-formed.js +1 -0
- package/features/string/virtual/is-well-formed.js +1 -0
- package/features/string/virtual/to-well-formed.js +1 -0
- package/full/array/from-async.js +2 -7
- package/full/array/index.js +0 -1
- package/full/index.js +3 -0
- package/full/instance/is-well-formed.js +10 -0
- package/full/instance/to-well-formed.js +10 -0
- package/full/self.js +3 -0
- package/full/string/index.js +2 -0
- package/full/string/is-well-formed.js +3 -0
- package/full/string/to-well-formed.js +3 -0
- package/full/string/virtual/index.js +2 -0
- package/full/string/virtual/is-well-formed.js +3 -0
- package/full/string/virtual/to-well-formed.js +3 -0
- package/internals/array-from-async.js +18 -3
- package/internals/async-from-sync-iterator.js +3 -6
- package/internals/async-iterator-create-proxy.js +3 -3
- package/internals/async-iterator-iteration.js +16 -10
- package/internals/classof-raw.js +3 -3
- package/internals/fix-regexp-well-known-symbol-logic.js +1 -1
- package/internals/function-bind-context.js +1 -1
- package/internals/function-uncurry-this-clause.js +9 -0
- package/internals/function-uncurry-this.js +9 -7
- package/internals/get-async-iterator-flattenable.js +28 -0
- package/internals/get-async-iterator.js +2 -1
- package/internals/get-iterator-flattenable.js +11 -0
- package/internals/iterator-create-proxy.js +3 -3
- package/internals/shared.js +2 -2
- package/modules/es.array-buffer.slice.js +1 -1
- package/modules/es.array.index-of.js +1 -1
- package/modules/es.string.ends-with.js +1 -1
- package/modules/es.string.match-all.js +1 -1
- package/modules/es.string.starts-with.js +1 -1
- package/modules/es.typed-array.sort.js +1 -1
- package/modules/esnext.array.from-async.js +1 -1
- package/modules/esnext.async-iterator.filter.js +8 -2
- package/modules/esnext.async-iterator.flat-map.js +15 -11
- package/modules/esnext.async-iterator.from.js +5 -22
- package/modules/esnext.async-iterator.indexed.js +1 -0
- package/modules/esnext.async-iterator.map.js +8 -2
- package/modules/esnext.async-iterator.reduce.js +11 -3
- package/modules/esnext.function.un-this.js +2 -2
- package/modules/esnext.iterator.every.js +2 -1
- package/modules/esnext.iterator.filter.js +1 -1
- package/modules/esnext.iterator.find.js +2 -1
- package/modules/esnext.iterator.flat-map.js +7 -18
- package/modules/esnext.iterator.for-each.js +7 -1
- package/modules/esnext.iterator.from.js +5 -13
- package/modules/esnext.iterator.indexed.js +1 -0
- package/modules/esnext.iterator.map.js +1 -1
- package/modules/esnext.iterator.reduce.js +3 -1
- package/modules/esnext.iterator.some.js +2 -1
- package/modules/esnext.iterator.to-async.js +1 -1
- package/modules/esnext.string.is-well-formed.js +23 -0
- package/modules/esnext.string.to-well-formed.js +33 -0
- package/modules/web.self.js +41 -0
- package/package.json +27 -14
- package/proposals/well-formed-unicode-strings.js +2 -0
- package/stable/index.js +1 -0
- package/stable/self.js +4 -0
- package/stage/0.js +2 -1
- package/stage/1.js +2 -1
- package/stage/2.js +3 -2
- package/stage/3.js +3 -1
- package/stage/4.js +1 -0
- package/stage/pre.js +2 -1
- package/web/index.js +1 -0
- package/internals/function-uncurry-this-raw.js +0 -11
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<div align="center">
|
|
4
4
|
|
|
5
|
-
[](https://opencollective.com/core-js) [](https://github.com/zloirock/core-js/blob/master/CONTRIBUTING.md) [](https://www.npmjs.com/package/core-js) [](https://npm-stat.com/charts.html?package=core-js&package=core-js-pure&package=core-js-compat&from=2014-11-18)
|
|
5
|
+
[](https://opencollective.com/core-js) [](https://github.com/zloirock/core-js/blob/master/CONTRIBUTING.md) [](https://www.npmjs.com/package/core-js) [](https://npm-stat.com/charts.html?package=core-js&package=core-js-pure&package=core-js-compat&from=2014-11-18)
|
|
6
6
|
|
|
7
7
|
</div>
|
|
8
8
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
require('../../modules/es.array.iterator');
|
|
2
|
+
require('../../modules/es.object.to-string');
|
|
3
|
+
require('../../modules/es.promise');
|
|
4
|
+
require('../../modules/es.string.iterator');
|
|
5
|
+
require('../../modules/esnext.array.from-async');
|
|
6
|
+
var path = require('../../internals/path');
|
|
7
|
+
|
|
8
|
+
module.exports = path.Array.fromAsync;
|
package/actual/array/index.js
CHANGED
|
@@ -3,6 +3,7 @@ require('../../modules/es.map');
|
|
|
3
3
|
require('../../modules/es.object.to-string');
|
|
4
4
|
require('../../modules/esnext.array.find-last');
|
|
5
5
|
require('../../modules/esnext.array.find-last-index');
|
|
6
|
+
require('../../modules/esnext.array.from-async');
|
|
6
7
|
require('../../modules/esnext.array.group');
|
|
7
8
|
require('../../modules/esnext.array.group-by');
|
|
8
9
|
require('../../modules/esnext.array.group-by-to-map');
|
package/actual/self.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../../full/instance/is-well-formed');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../../full/instance/to-well-formed');
|
package/features/self.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../full/self');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../../full/string/is-well-formed');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../../full/string/to-well-formed');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../../../full/string/virtual/is-well-formed');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../../../full/string/virtual/to-well-formed');
|
package/full/array/from-async.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
require('../../
|
|
2
|
-
require('../../modules/es.object.to-string');
|
|
3
|
-
require('../../modules/es.promise');
|
|
4
|
-
require('../../modules/es.string.iterator');
|
|
5
|
-
require('../../modules/esnext.array.from-async');
|
|
6
|
-
var path = require('../../internals/path');
|
|
1
|
+
var parent = require('../../actual/array/from-async');
|
|
7
2
|
|
|
8
|
-
module.exports =
|
|
3
|
+
module.exports = parent;
|
package/full/array/index.js
CHANGED
package/full/index.js
CHANGED
|
@@ -361,8 +361,10 @@ require('../modules/esnext.set.union');
|
|
|
361
361
|
require('../modules/esnext.string.at');
|
|
362
362
|
require('../modules/esnext.string.cooked');
|
|
363
363
|
require('../modules/esnext.string.code-points');
|
|
364
|
+
require('../modules/esnext.string.is-well-formed');
|
|
364
365
|
require('../modules/esnext.string.match-all');
|
|
365
366
|
require('../modules/esnext.string.replace-all');
|
|
367
|
+
require('../modules/esnext.string.to-well-formed');
|
|
366
368
|
require('../modules/esnext.symbol.async-dispose');
|
|
367
369
|
require('../modules/esnext.symbol.dispose');
|
|
368
370
|
require('../modules/esnext.symbol.matcher');
|
|
@@ -401,6 +403,7 @@ require('../modules/web.dom-exception.stack');
|
|
|
401
403
|
require('../modules/web.dom-exception.to-string-tag');
|
|
402
404
|
require('../modules/web.immediate');
|
|
403
405
|
require('../modules/web.queue-microtask');
|
|
406
|
+
require('../modules/web.self');
|
|
404
407
|
require('../modules/web.structured-clone');
|
|
405
408
|
require('../modules/web.timers');
|
|
406
409
|
require('../modules/web.url');
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var isPrototypeOf = require('../../internals/object-is-prototype-of');
|
|
2
|
+
var method = require('../string/virtual/is-well-formed');
|
|
3
|
+
|
|
4
|
+
var StringPrototype = String.prototype;
|
|
5
|
+
|
|
6
|
+
module.exports = function (it) {
|
|
7
|
+
var own = it.isWellFormed;
|
|
8
|
+
return typeof it == 'string' || it === StringPrototype
|
|
9
|
+
|| (isPrototypeOf(StringPrototype, it) && own === StringPrototype.isWellFormed) ? method : own;
|
|
10
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var isPrototypeOf = require('../../internals/object-is-prototype-of');
|
|
2
|
+
var method = require('../string/virtual/to-well-formed');
|
|
3
|
+
|
|
4
|
+
var StringPrototype = String.prototype;
|
|
5
|
+
|
|
6
|
+
module.exports = function (it) {
|
|
7
|
+
var own = it.toWellFormed;
|
|
8
|
+
return typeof it == 'string' || it === StringPrototype
|
|
9
|
+
|| (isPrototypeOf(StringPrototype, it) && own === StringPrototype.toWellFormed) ? method : own;
|
|
10
|
+
};
|
package/full/self.js
ADDED
package/full/string/index.js
CHANGED
|
@@ -3,8 +3,10 @@ var parent = require('../../actual/string');
|
|
|
3
3
|
require('../../modules/esnext.string.at');
|
|
4
4
|
require('../../modules/esnext.string.cooked');
|
|
5
5
|
require('../../modules/esnext.string.code-points');
|
|
6
|
+
require('../../modules/esnext.string.is-well-formed');
|
|
6
7
|
// TODO: remove from `core-js@4`
|
|
7
8
|
require('../../modules/esnext.string.match-all');
|
|
8
9
|
require('../../modules/esnext.string.replace-all');
|
|
10
|
+
require('../../modules/esnext.string.to-well-formed');
|
|
9
11
|
|
|
10
12
|
module.exports = parent;
|
|
@@ -2,8 +2,10 @@ var parent = require('../../../actual/string/virtual');
|
|
|
2
2
|
// TODO: remove from `core-js@4`
|
|
3
3
|
require('../../../modules/esnext.string.at');
|
|
4
4
|
require('../../../modules/esnext.string.code-points');
|
|
5
|
+
require('../../../modules/esnext.string.is-well-formed');
|
|
5
6
|
// TODO: remove from `core-js@4`
|
|
6
7
|
require('../../../modules/esnext.string.match-all');
|
|
7
8
|
require('../../../modules/esnext.string.replace-all');
|
|
9
|
+
require('../../../modules/esnext.string.to-well-formed');
|
|
8
10
|
|
|
9
11
|
module.exports = parent;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
var bind = require('../internals/function-bind-context');
|
|
3
|
+
var uncurryThis = require('../internals/function-uncurry-this');
|
|
3
4
|
var toObject = require('../internals/to-object');
|
|
4
5
|
var isConstructor = require('../internals/is-constructor');
|
|
5
6
|
var getAsyncIterator = require('../internals/get-async-iterator');
|
|
6
7
|
var getIterator = require('../internals/get-iterator');
|
|
8
|
+
var getIteratorDirect = require('../internals/get-iterator-direct');
|
|
7
9
|
var getIteratorMethod = require('../internals/get-iterator-method');
|
|
8
10
|
var getMethod = require('../internals/get-method');
|
|
9
11
|
var getVirtual = require('../internals/entry-virtual');
|
|
@@ -13,7 +15,20 @@ var AsyncFromSyncIterator = require('../internals/async-from-sync-iterator');
|
|
|
13
15
|
var toArray = require('../internals/async-iterator-iteration').toArray;
|
|
14
16
|
|
|
15
17
|
var ASYNC_ITERATOR = wellKnownSymbol('asyncIterator');
|
|
16
|
-
var arrayIterator = getVirtual('Array').values;
|
|
18
|
+
var arrayIterator = uncurryThis(getVirtual('Array').values);
|
|
19
|
+
var arrayIteratorNext = uncurryThis(arrayIterator([]).next);
|
|
20
|
+
|
|
21
|
+
var safeArrayIterator = function () {
|
|
22
|
+
return new SafeArrayIterator(this);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
var SafeArrayIterator = function (O) {
|
|
26
|
+
this.iterator = arrayIterator(O);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
SafeArrayIterator.prototype.next = function () {
|
|
30
|
+
return arrayIteratorNext(this.iterator);
|
|
31
|
+
};
|
|
17
32
|
|
|
18
33
|
// `Array.fromAsync` method implementation
|
|
19
34
|
// https://github.com/tc39/proposal-array-from-async
|
|
@@ -26,11 +41,11 @@ module.exports = function fromAsync(asyncItems /* , mapfn = undefined, thisArg =
|
|
|
26
41
|
var O = toObject(asyncItems);
|
|
27
42
|
if (mapfn !== undefined) mapfn = bind(mapfn, thisArg);
|
|
28
43
|
var usingAsyncIterator = getMethod(O, ASYNC_ITERATOR);
|
|
29
|
-
var usingSyncIterator = usingAsyncIterator ? undefined : getIteratorMethod(O) ||
|
|
44
|
+
var usingSyncIterator = usingAsyncIterator ? undefined : getIteratorMethod(O) || safeArrayIterator;
|
|
30
45
|
var A = isConstructor(C) ? new C() : [];
|
|
31
46
|
var iterator = usingAsyncIterator
|
|
32
47
|
? getAsyncIterator(O, usingAsyncIterator)
|
|
33
|
-
: new AsyncFromSyncIterator(getIterator(O, usingSyncIterator));
|
|
48
|
+
: new AsyncFromSyncIterator(getIteratorDirect(getIterator(O, usingSyncIterator)));
|
|
34
49
|
resolve(toArray(iterator, mapfn, A));
|
|
35
50
|
});
|
|
36
51
|
};
|
|
@@ -22,12 +22,9 @@ var asyncFromSyncIteratorContinuation = function (result, resolve, reject) {
|
|
|
22
22
|
}, reject);
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
var AsyncFromSyncIterator = function AsyncIterator(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
iterator: anObject(iterator),
|
|
29
|
-
next: iterator.next
|
|
30
|
-
});
|
|
25
|
+
var AsyncFromSyncIterator = function AsyncIterator(iteratorRecord) {
|
|
26
|
+
iteratorRecord.type = ASYNC_FROM_SYNC_ITERATOR;
|
|
27
|
+
setInternalState(this, iteratorRecord);
|
|
31
28
|
};
|
|
32
29
|
|
|
33
30
|
AsyncFromSyncIterator.prototype = defineBuiltIns(create(AsyncIteratorPrototype), {
|
|
@@ -79,11 +79,10 @@ var createAsyncIteratorProxyPrototype = function (IS_ITERATOR) {
|
|
|
79
79
|
return exit ? state : enqueue(state, function () {
|
|
80
80
|
state.done = true;
|
|
81
81
|
var iterator = state.iterator;
|
|
82
|
-
var innerIterator = state.innerIterator;
|
|
83
82
|
var returnMethod, result;
|
|
84
83
|
var completion = perform(function () {
|
|
85
|
-
if (
|
|
86
|
-
iteratorClose(
|
|
84
|
+
if (state.inner) try {
|
|
85
|
+
iteratorClose(state.inner.iterator, 'return');
|
|
87
86
|
} catch (error) {
|
|
88
87
|
return iteratorClose(iterator, 'throw', error);
|
|
89
88
|
}
|
|
@@ -125,6 +124,7 @@ module.exports = function (nextHandler, IS_ITERATOR) {
|
|
|
125
124
|
} else state = record;
|
|
126
125
|
state.type = ASYNC_ITERATOR_PROXY;
|
|
127
126
|
state.nextHandler = nextHandler;
|
|
127
|
+
state.counter = 0;
|
|
128
128
|
state.done = false;
|
|
129
129
|
state.awaiting = null;
|
|
130
130
|
setInternalState(this, state);
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
var call = require('../internals/function-call');
|
|
5
5
|
var aCallable = require('../internals/a-callable');
|
|
6
6
|
var anObject = require('../internals/an-object');
|
|
7
|
+
var isObject = require('../internals/is-object');
|
|
7
8
|
var doesNotExceedSafeInteger = require('../internals/does-not-exceed-safe-integer');
|
|
8
9
|
var getBuiltIn = require('../internals/get-built-in');
|
|
9
10
|
var getIteratorDirect = require('../internals/get-iterator-direct');
|
|
@@ -19,7 +20,7 @@ var createMethod = function (TYPE) {
|
|
|
19
20
|
var Promise = getBuiltIn('Promise');
|
|
20
21
|
var iterator = record.iterator;
|
|
21
22
|
var next = record.next;
|
|
22
|
-
var
|
|
23
|
+
var counter = 0;
|
|
23
24
|
var MAPPING = fn !== undefined;
|
|
24
25
|
if (MAPPING || !IS_TO_ARRAY) aCallable(fn);
|
|
25
26
|
|
|
@@ -30,36 +31,41 @@ var createMethod = function (TYPE) {
|
|
|
30
31
|
|
|
31
32
|
var loop = function () {
|
|
32
33
|
try {
|
|
33
|
-
if (
|
|
34
|
-
doesNotExceedSafeInteger(
|
|
34
|
+
if (MAPPING) try {
|
|
35
|
+
doesNotExceedSafeInteger(counter);
|
|
35
36
|
} catch (error5) { ifAbruptCloseAsyncIterator(error5); }
|
|
36
37
|
Promise.resolve(anObject(call(next, iterator))).then(function (step) {
|
|
37
38
|
try {
|
|
38
39
|
if (anObject(step).done) {
|
|
39
40
|
if (IS_TO_ARRAY) {
|
|
40
|
-
target.length =
|
|
41
|
+
target.length = counter;
|
|
41
42
|
resolve(target);
|
|
42
43
|
} else resolve(IS_SOME ? false : IS_EVERY || undefined);
|
|
43
44
|
} else {
|
|
44
45
|
var value = step.value;
|
|
45
46
|
try {
|
|
46
47
|
if (MAPPING) {
|
|
47
|
-
|
|
48
|
+
var result = fn(value, counter);
|
|
49
|
+
|
|
50
|
+
var handler = function ($result) {
|
|
48
51
|
if (IS_FOR_EACH) {
|
|
49
52
|
loop();
|
|
50
53
|
} else if (IS_EVERY) {
|
|
51
|
-
result ? loop() : closeAsyncIteration(iterator, resolve, false, reject);
|
|
54
|
+
$result ? loop() : closeAsyncIteration(iterator, resolve, false, reject);
|
|
52
55
|
} else if (IS_TO_ARRAY) {
|
|
53
56
|
try {
|
|
54
|
-
target[
|
|
57
|
+
target[counter++] = $result;
|
|
55
58
|
loop();
|
|
56
59
|
} catch (error4) { ifAbruptCloseAsyncIterator(error4); }
|
|
57
60
|
} else {
|
|
58
|
-
result ? closeAsyncIteration(iterator, resolve, IS_SOME || value, reject) : loop();
|
|
61
|
+
$result ? closeAsyncIteration(iterator, resolve, IS_SOME || value, reject) : loop();
|
|
59
62
|
}
|
|
60
|
-
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
if (isObject(result)) Promise.resolve(result).then(handler, ifAbruptCloseAsyncIterator);
|
|
66
|
+
else handler(result);
|
|
61
67
|
} else {
|
|
62
|
-
target[
|
|
68
|
+
target[counter++] = value;
|
|
63
69
|
loop();
|
|
64
70
|
}
|
|
65
71
|
} catch (error3) { ifAbruptCloseAsyncIterator(error3); }
|
package/internals/classof-raw.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
1
|
+
var uncurryThis = require('../internals/function-uncurry-this');
|
|
2
2
|
|
|
3
|
-
var toString =
|
|
4
|
-
var stringSlice =
|
|
3
|
+
var toString = uncurryThis({}.toString);
|
|
4
|
+
var stringSlice = uncurryThis(''.slice);
|
|
5
5
|
|
|
6
6
|
module.exports = function (it) {
|
|
7
7
|
return stringSlice(toString(it), 8, -1);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
// TODO: Remove from `core-js@4` since it's moved to entry points
|
|
3
3
|
require('../modules/es.regexp.exec');
|
|
4
|
-
var uncurryThis = require('../internals/function-uncurry-this');
|
|
4
|
+
var uncurryThis = require('../internals/function-uncurry-this-clause');
|
|
5
5
|
var defineBuiltIn = require('../internals/define-built-in');
|
|
6
6
|
var regexpExec = require('../internals/regexp-exec');
|
|
7
7
|
var fails = require('../internals/fails');
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var classofRaw = require('../internals/classof-raw');
|
|
2
|
+
var uncurryThis = require('../internals/function-uncurry-this');
|
|
3
|
+
|
|
4
|
+
module.exports = function (fn) {
|
|
5
|
+
// Nashorn bug:
|
|
6
|
+
// https://github.com/zloirock/core-js/issues/1128
|
|
7
|
+
// https://github.com/zloirock/core-js/issues/1130
|
|
8
|
+
if (classofRaw(fn) === 'Function') return uncurryThis(fn);
|
|
9
|
+
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var uncurryThisRaw = require('../internals/function-uncurry-this-raw');
|
|
1
|
+
var NATIVE_BIND = require('../internals/function-bind-native');
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
var FunctionPrototype = Function.prototype;
|
|
4
|
+
var call = FunctionPrototype.call;
|
|
5
|
+
var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call);
|
|
6
|
+
|
|
7
|
+
module.exports = NATIVE_BIND ? uncurryThisWithBind : function (fn) {
|
|
8
|
+
return function () {
|
|
9
|
+
return call.apply(fn, arguments);
|
|
10
|
+
};
|
|
9
11
|
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var call = require('../internals/function-call');
|
|
2
|
+
var isCallable = require('../internals/is-callable');
|
|
3
|
+
var toObject = require('../internals/to-object');
|
|
4
|
+
var getIteratorDirect = require('../internals/get-iterator-direct');
|
|
5
|
+
var getIteratorMethod = require('../internals/get-iterator-method');
|
|
6
|
+
var getMethod = require('../internals/get-method');
|
|
7
|
+
var wellKnownSymbol = require('../internals/well-known-symbol');
|
|
8
|
+
var AsyncFromSyncIterator = require('../internals/async-from-sync-iterator');
|
|
9
|
+
|
|
10
|
+
var ASYNC_ITERATOR = wellKnownSymbol('asyncIterator');
|
|
11
|
+
|
|
12
|
+
module.exports = function from(obj) {
|
|
13
|
+
var object = toObject(obj);
|
|
14
|
+
var alreadyAsync = true;
|
|
15
|
+
var method = getMethod(object, ASYNC_ITERATOR);
|
|
16
|
+
var iterator;
|
|
17
|
+
if (!isCallable(method)) {
|
|
18
|
+
method = getIteratorMethod(object);
|
|
19
|
+
alreadyAsync = false;
|
|
20
|
+
}
|
|
21
|
+
if (isCallable(method)) {
|
|
22
|
+
iterator = call(method, object);
|
|
23
|
+
} else {
|
|
24
|
+
iterator = object;
|
|
25
|
+
alreadyAsync = true;
|
|
26
|
+
}
|
|
27
|
+
return getIteratorDirect(alreadyAsync ? iterator : new AsyncFromSyncIterator(getIteratorDirect(iterator)));
|
|
28
|
+
};
|
|
@@ -2,6 +2,7 @@ var call = require('../internals/function-call');
|
|
|
2
2
|
var AsyncFromSyncIterator = require('../internals/async-from-sync-iterator');
|
|
3
3
|
var anObject = require('../internals/an-object');
|
|
4
4
|
var getIterator = require('../internals/get-iterator');
|
|
5
|
+
var getIteratorDirect = require('../internals/get-iterator-direct');
|
|
5
6
|
var getMethod = require('../internals/get-method');
|
|
6
7
|
var wellKnownSymbol = require('../internals/well-known-symbol');
|
|
7
8
|
|
|
@@ -9,5 +10,5 @@ var ASYNC_ITERATOR = wellKnownSymbol('asyncIterator');
|
|
|
9
10
|
|
|
10
11
|
module.exports = function (it, usingIterator) {
|
|
11
12
|
var method = arguments.length < 2 ? getMethod(it, ASYNC_ITERATOR) : usingIterator;
|
|
12
|
-
return method ? anObject(call(method, it)) : new AsyncFromSyncIterator(getIterator(it));
|
|
13
|
+
return method ? anObject(call(method, it)) : new AsyncFromSyncIterator(getIteratorDirect(getIterator(it)));
|
|
13
14
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
var call = require('../internals/function-call');
|
|
2
|
+
var isCallable = require('../internals/is-callable');
|
|
3
|
+
var toObject = require('../internals/to-object');
|
|
4
|
+
var getIteratorDirect = require('../internals/get-iterator-direct');
|
|
5
|
+
var getIteratorMethod = require('../internals/get-iterator-method');
|
|
6
|
+
|
|
7
|
+
module.exports = function (obj) {
|
|
8
|
+
var object = toObject(obj);
|
|
9
|
+
var method = getIteratorMethod(object);
|
|
10
|
+
return getIteratorDirect(isCallable(method) ? call(method, object) : object);
|
|
11
|
+
};
|
|
@@ -44,9 +44,8 @@ var createIteratorProxyPrototype = function (IS_ITERATOR) {
|
|
|
44
44
|
var returnMethod = getMethod(iterator, 'return');
|
|
45
45
|
return returnMethod ? call(returnMethod, iterator) : createIterResultObject(undefined, true);
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
iteratorClose(innerIterator, 'return');
|
|
47
|
+
if (state.inner) try {
|
|
48
|
+
iteratorClose(state.inner.iterator, 'return');
|
|
50
49
|
} catch (error) {
|
|
51
50
|
return iteratorClose(iterator, 'throw', error);
|
|
52
51
|
}
|
|
@@ -75,6 +74,7 @@ module.exports = function (nextHandler, IS_ITERATOR) {
|
|
|
75
74
|
} else state = record;
|
|
76
75
|
state.type = ITERATOR_PROXY;
|
|
77
76
|
state.nextHandler = nextHandler;
|
|
77
|
+
state.counter = 0;
|
|
78
78
|
state.done = false;
|
|
79
79
|
setInternalState(this, state);
|
|
80
80
|
};
|
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.
|
|
7
|
+
version: '3.26.1',
|
|
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.
|
|
10
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.26.1/LICENSE',
|
|
11
11
|
source: 'https://github.com/zloirock/core-js'
|
|
12
12
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
var $ = require('../internals/export');
|
|
3
|
-
var uncurryThis = require('../internals/function-uncurry-this');
|
|
3
|
+
var uncurryThis = require('../internals/function-uncurry-this-clause');
|
|
4
4
|
var fails = require('../internals/fails');
|
|
5
5
|
var ArrayBufferModule = require('../internals/array-buffer');
|
|
6
6
|
var anObject = require('../internals/an-object');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/* eslint-disable es/no-array-prototype-indexof -- required for testing */
|
|
3
3
|
var $ = require('../internals/export');
|
|
4
|
-
var uncurryThis = require('../internals/function-uncurry-this');
|
|
4
|
+
var uncurryThis = require('../internals/function-uncurry-this-clause');
|
|
5
5
|
var $indexOf = require('../internals/array-includes').indexOf;
|
|
6
6
|
var arrayMethodIsStrict = require('../internals/array-method-is-strict');
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
var $ = require('../internals/export');
|
|
3
|
-
var uncurryThis = require('../internals/function-uncurry-this');
|
|
3
|
+
var uncurryThis = require('../internals/function-uncurry-this-clause');
|
|
4
4
|
var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
|
|
5
5
|
var toLength = require('../internals/to-length');
|
|
6
6
|
var toString = require('../internals/to-string');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable es/no-string-prototype-matchall -- safe */
|
|
3
3
|
var $ = require('../internals/export');
|
|
4
4
|
var call = require('../internals/function-call');
|
|
5
|
-
var uncurryThis = require('../internals/function-uncurry-this');
|
|
5
|
+
var uncurryThis = require('../internals/function-uncurry-this-clause');
|
|
6
6
|
var createIteratorConstructor = require('../internals/iterator-create-constructor');
|
|
7
7
|
var createIterResultObject = require('../internals/create-iter-result-object');
|
|
8
8
|
var requireObjectCoercible = require('../internals/require-object-coercible');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
var $ = require('../internals/export');
|
|
3
|
-
var uncurryThis = require('../internals/function-uncurry-this');
|
|
3
|
+
var uncurryThis = require('../internals/function-uncurry-this-clause');
|
|
4
4
|
var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
|
|
5
5
|
var toLength = require('../internals/to-length');
|
|
6
6
|
var toString = require('../internals/to-string');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
var global = require('../internals/global');
|
|
3
|
-
var uncurryThis = require('../internals/function-uncurry-this');
|
|
3
|
+
var uncurryThis = require('../internals/function-uncurry-this-clause');
|
|
4
4
|
var fails = require('../internals/fails');
|
|
5
5
|
var aCallable = require('../internals/a-callable');
|
|
6
6
|
var internalSort = require('../internals/array-sort');
|
|
@@ -4,6 +4,7 @@ var $ = require('../internals/export');
|
|
|
4
4
|
var call = require('../internals/function-call');
|
|
5
5
|
var aCallable = require('../internals/a-callable');
|
|
6
6
|
var anObject = require('../internals/an-object');
|
|
7
|
+
var isObject = require('../internals/is-object');
|
|
7
8
|
var getIteratorDirect = require('../internals/get-iterator-direct');
|
|
8
9
|
var createAsyncIteratorProxy = require('../internals/async-iterator-create-proxy');
|
|
9
10
|
var createIterResultObject = require('../internals/create-iter-result-object');
|
|
@@ -34,9 +35,14 @@ var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise) {
|
|
|
34
35
|
} else {
|
|
35
36
|
var value = step.value;
|
|
36
37
|
try {
|
|
37
|
-
|
|
38
|
+
var result = filterer(value, state.counter++);
|
|
39
|
+
|
|
40
|
+
var handler = function (selected) {
|
|
38
41
|
selected ? resolve(createIterResultObject(value, false)) : loop();
|
|
39
|
-
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
if (isObject(result)) Promise.resolve(result).then(handler, ifAbruptCloseAsyncIterator);
|
|
45
|
+
else handler(result);
|
|
40
46
|
} catch (error3) { ifAbruptCloseAsyncIterator(error3); }
|
|
41
47
|
}
|
|
42
48
|
} catch (error2) { doneAndReject(error2); }
|