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.
267
267
For example:
268
268
269
269
` ` ` js
270
- function as () {
270
+ function createAsyncIter () {
271
+ let i = 0 ;
271
272
return {
272
273
[Symbol .asyncIterator ]() {
273
274
return {
@@ -282,10 +283,10 @@ function as () {
282
283
}
283
284
284
285
// 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 () ));
286
287
287
288
// This prints `[1, 2, 3]`:
288
- console .log (await Array .fromAsync (it , x => x));
289
+ console .log (await Array .fromAsync (createAsyncIter () , x => x));
289
290
` ` `
290
291
291
292
See 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