File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -399,10 +399,12 @@ Array.fromAsync([], 1);
399
399
## Other proposals
400
400
401
401
### Relationship with iterator-helpers
402
- The [iterator-helpers][] proposal has toArray, which works with both sync and
403
- async iterables. The following pairs of lines are equivalent:
402
+ The [iterator-helpers][] and [async-iterator-helpers][] proposal define
403
+ Iterator.toArray and AsyncIterator.toArray. The following pairs of lines are
404
+ equivalent:
404
405
405
406
[iterator-helpers]: https://github.com/tc39/proposal-iterator-helpers
407
+ [async-iterator-helpers]: https://github.com/tc39/proposal-async-iterator-helpers
406
408
407
409
` ` ` js
408
410
// Array.from
@@ -422,10 +424,8 @@ Array.fromAsync(asyncIterable, mapfn)
422
424
AsyncIterator (asyncIterable).map (mapfn).toArray ()
423
425
` ` `
424
426
425
- toArray overlaps with both Array.from and Array.fromAsync. This is okay. They
426
- can coexist. If we have to choose between having toArray and having fromAsync,
427
- then we should choose fromAsync. We already have Array.from. We should match
428
- the existing language precedent.
427
+ Iterator.toArray overlaps with Array.from, and AsyncIterator.toArray overlaps
428
+ with Array.fromAsync. This is okay: they all can coexist.
429
429
430
430
A [co-champion of iterable-helpers agrees][tc39/proposal-iterator-helpers#156]
431
431
that we should have both or that we should prefer Array.fromAsync: “I
You can’t perform that action at this time.
0 commit comments