Skip to content

Commit 283fb1d

Browse files
committed
docs: Clarify arguments for Array.from[Async]/toArray
1 parent 3f26c95 commit 283fb1d

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -400,26 +400,26 @@ Array.fromAsync([], 1);
400400
401401
### Relationship with iterator-helpers
402402
The [iterator-helpers][] proposal has toArray, which works with both sync and
403-
async iterables.
403+
async iterables. The following pairs of lines are equivalent:
404404
405405
[iterator-helpers]: https://github.com/tc39/proposal-iterator-helpers
406406
407407
```js
408408
// Array.from
409409

410-
Array.from(input)
411-
Iterator(input).toArray()
410+
Array.from(iterable)
411+
Iterator(iterable).toArray()
412412

413-
Array.from(input, mapfn)
414-
Iterator(input).map(mapfn).toArray()
413+
Array.from(iterable, mapfn)
414+
Iterator(iterable).map(mapfn).toArray()
415415

416416
// Array.asyncFrom
417417

418-
Array.fromAsync(input)
419-
AsyncIterator(input).toArray()
418+
Array.fromAsync(asyncIterable)
419+
AsyncIterator(asyncIterable).toArray()
420420

421-
Array.fromAsync(input, mapfn)
422-
AsyncIterator(input).map(mapfn).toArray()
421+
Array.fromAsync(asyncIterable, mapfn)
422+
AsyncIterator(asyncIterable).map(mapfn).toArray()
423423
```
424424
425425
toArray overlaps with both Array.from and Array.fromAsync. This is okay. They

0 commit comments

Comments
 (0)