Skip to content

Commit f540775

Browse files
committed
Clarify that values from async inputs are awaited when callback omitted
See #29, #20, and #23.
1 parent cf49c0c commit f540775

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

‎README.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ that uses ad-hoc `for await`–`of` loops with empty arrays:
3131
```js
3232
constarr= [];
3333
forawait (constitemofasyncItems){
34-
arr.push(item);
34+
arr.push(awaititem);
3535
}
3636
```
3737
Further demonstrating the demand for such functionality,
@@ -71,7 +71,7 @@ async function * asyncGen (n){
7171
// `arr` will be `[0, 2, 4, 6]`.
7272
constarr= [];
7373
forawait (constvofasyncGen(4)){
74-
arr.push(v);
74+
arr.push(awaitv);
7575
}
7676

7777
// This is equivalent.
@@ -96,7 +96,7 @@ function * genPromises (n){
9696
// `arr` will be `[ 0, 2, 4, 6 ]`.
9797
constarr= [];
9898
forawait (constvofgenPromises(4)){
99-
arr.push(v);
99+
arr.push(awaitv);
100100
}
101101

102102
// This is equivalent.
@@ -174,7 +174,7 @@ const arrLike ={
174174
// `arr` will be `[ 0, 2, 4, 6 ]`.
175175
constarr= [];
176176
forawait (constvofArray.from(arrLike)){
177-
arr.push(v);
177+
arr.push(awaitv);
178178
}
179179

180180
// This is equivalent.
@@ -239,7 +239,7 @@ async function * asyncGen (n){
239239
// `arr` will be `[ 0, 4, 16, 36 ]`.
240240
constarr= [];
241241
forawait (constvofasyncGen(4)){
242-
arr.push(v **2);
242+
arr.push(await (v **2));
243243
}
244244

245245
// This is equivalent.

0 commit comments

Comments
(0)