From 74384a4b38dd82c6db489641494a148ebd9bf0b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=C2=A0S=2E=20Choi?= Date: Mon, 11 Jul 2022 14:52:06 -0400 Subject: [PATCH 1/3] =?UTF-8?q?Revert=20#20=20and=20do=20not=20await=20asy?= =?UTF-8?q?nc=20inputs=E2=80=99=20values=20without=20mapping=20=C6=92=20Cl?= =?UTF-8?q?oses=20#19.=20See=20.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 14 +++++++++----- spec.html | 6 +++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 243118e..84bc4c8 100644 --- a/README.md +++ b/README.md @@ -219,11 +219,15 @@ const d = await Data.fromAsync(asyncGen(4)); ### Optional parameters Array.fromAsync has two optional parameters: `mapfn` and `thisArg`. -`mapfn` is a mapping callback, which is called on each value yielded from the -input (and awaited if it came from a synchronous input), along with its index -integer (starting from 0). Each result of the mapping callback is, in turn, -awaited then added to the array. By default, the callback is essentially an -identity function. +`mapfn` is an optional mapping callback, which is called on each value yielded +from the input (and awaited if it came from a synchronous input), along with +its index integer (starting from 0). Each result of the mapping callback is, in +turn, awaited then added to the array. + +(Without the optional mapping callback, each value yielded from asynchronous +inputs is not awaited, and each value yielded from synchronous inputs is +awaited only once, before the value is added to the result array. This matches +the behavior of `for await`.) `thisArg` is a `this`-binding receiver value for the mapping callback. By default, this is undefined. These optional parameters match the behavior of diff --git a/spec.html b/spec.html index c0d4008..cfe1e95 100644 --- a/spec.html +++ b/spec.html @@ -74,10 +74,10 @@

Array.fromAsync ( _asyncItems_ [ , _mapfn_ [ , _thisArg_ ] ] ) Date: Mon, 11 Jul 2022 23:25:06 -0400 Subject: [PATCH 2/3] spec: Swap IfAbruptCloseAsyncIterator arguments Co-authored-by: Kevin Gibbons --- spec.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec.html b/spec.html index cfe1e95..99c511b 100644 --- a/spec.html +++ b/spec.html @@ -73,9 +73,9 @@

Array.fromAsync ( _asyncItems_ [ , _mapfn_ [ , _thisArg_ ] ] ) Date: Tue, 12 Jul 2022 00:48:38 -0400 Subject: [PATCH 3/3] Remove redundant unwrapping of Completion Record IfAbruptCloseIterator already takes care of this. --- spec.html | 1 - 1 file changed, 1 deletion(-) diff --git a/spec.html b/spec.html index 99c511b..5a774cd 100644 --- a/spec.html +++ b/spec.html @@ -76,7 +76,6 @@

Array.fromAsync ( _asyncItems_ [ , _mapfn_ [ , _thisArg_ ] ] )