File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -267,7 +267,8 @@ because the result of the `x => x` mapping function is awaited.
267267For example:
268268
269269` ` ` js
270- function as () {
270+ function createAsyncIter () {
271+ let i = 0 ;
271272 return {
272273 [Symbol .asyncIterator ]() {
273274 return {
@@ -282,10 +283,10 @@ function as () {
282283}
283284
284285// This prints `[Promise.resolve(1), Promise.resolve(2), Promise.resolve(3)]`:
285- console .log (await Array .fromAsync (it ));
286+ console .log (await Array .fromAsync (createAsyncIter () ));
286287
287288// This prints `[1, 2, 3]`:
288- console .log (await Array .fromAsync (it , x => x));
289+ console .log (await Array .fromAsync (createAsyncIter () , x => x));
289290` ` `
290291
291292See also [issue #19](https://github.com/tc39/proposal-array-from-async/issues/19).
You can’t perform that action at this time.
0 commit comments