File tree 2 files changed +28
-6
lines changed
2 files changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -6,9 +6,19 @@ Presented to [plenary meeting as an update on 2021-10-26][2021-10-26].
6
6
7
7
# 2021-12
8
8
Presented to [ plenary meeting for Stage 2 on 2021-12-14] [ 2021-12-14 ] .
9
- Was rejected due to need to clarify awaiting semantics
9
+ Was rejected due to need to clarify ` await ` ing semantics
10
10
with and without mapping-function arguments.
11
11
12
+ # 2022-07
13
+ Discussion occurred about ` await ` ing semantics and mapping functions in [ issue
14
+ #19 ] [ ] . It was eventually decided to match ` for await ` and the proposed
15
+ [ AsyncIterator.prototype.toArray] [ iterator-helpers ] by ` await ` ing values from
16
+ input sync iterators once, ` await ` ing values from input async iterators not at
17
+ all, and ` await ` ing results returned by mapping functions once.
18
+
12
19
[ 2021-08-31 ] : https://github.com/tc39/notes/blob/HEAD/meetings/2021-08/aug-31.md
13
20
[ 2021-10-26 ] : https://github.com/tc39/notes/blob/HEAD/meetings/2021-10/oct-26.md#arrayfromasync-update
14
21
[ 2021-12-14 ] : https://github.com/tc39/notes/blob/HEAD/meetings/2021-12/dec-14.md#arrayfromasync-for-stage-2
22
+ [ issue #19 ] : https://github.com/tc39/proposal-array-from-async/issues/19
23
+ [ iterator-helpers ] : https://github.com/tc39/proposal-iterator-helpers
24
+ [ iterator-helpers#168 ] : https://github.com/tc39/proposal-iterator-helpers/issues/168
Original file line number Diff line number Diff line change @@ -402,11 +402,24 @@ Array.fromAsync([], 1);
402
402
The [iterator-helpers][] proposal has toArray, which works with both sync and
403
403
async iterables.
404
404
405
+ [iterator-helpers]: https://github.com/tc39/proposal-iterator-helpers
406
+
405
407
` ` ` js
406
- Array .from (gen ())
407
- gen ().toArray ()
408
- Array .fromAsync (asyncGen ())
409
- asyncGen ().toArray ()
408
+ // Array.from
409
+
410
+ Array .from (input)
411
+ Iterator (input).toArray ()
412
+
413
+ Array .from (input, mapfn)
414
+ Iterator (input).map (mapfn).toArray ()
415
+
416
+ // Array.asyncFrom
417
+
418
+ Array .fromAsync (input)
419
+ AsyncIterator (input).toArray ()
420
+
421
+ Array .fromAsync (input, mapfn)
422
+ AsyncIterator (input).map (mapfn).toArray ()
410
423
` ` `
411
424
412
425
toArray overlaps with both Array.from and Array.fromAsync. This is okay. They
@@ -422,7 +435,6 @@ something one element at a time is the same as building it [more than one]
422
435
element at a time, but sometimes it could be slow to build that way or produce
423
436
a structure with equivalent semantics but different performance properties.”
424
437
425
- [iterator-helpers]: https://github.com/tc39/proposal-iterator-helpers
426
438
[tc39/proposal-iterator-helpers#156]: https://github.com/tc39/proposal-iterator-helpers/issues/156.
427
439
428
440
### TypedArray.fromAsync, Set.fromAsync, Object.fromEntriesAsync, etc.
You can’t perform that action at this time.
0 commit comments