diff --git a/README.md b/README.md index 3ba4c42..1e50929 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,20 @@ will also reject with that error.) `thisArg` is an optional value with which to call `mapfn` (or `undefined` by default). -Like `Array.from`, `Array.fromAsync` is a **generic factory method**. +Like `for await`, when `Array.fromAsync` receives a **sync-iterable object** +(and that object is not async iterable), +then it creates a sync iterator for that object and adds its items to an array. +When **any yielded item is a promise**, then that promise will **block** the iteration +until it **resolves** to a value (in which case that value is what is added to the array) +or until it **rejects** with an error (in which case +the promise returned by `Array.fromAsync` itself will reject with that error). + +Like `Array.from`, `Array.fromAsync` also works on non-iterable **array-like objects** +(i.e., objects with a length property and indexed elements). +As with sync-iterable objects, any element that is a promise must settle first, +and the value to which it resolves (if any) will be what is added to the resulting array. + +Also like `Array.from`, `Array.fromAsync` is a **generic factory method**. It does not require that its `this` value be the `Array` constructor, and it can be transferred to or inherited by any other constructors that may be called with a single numeric argument. diff --git a/spec.html b/spec.html index 0c06bd5..c2ca09a 100644 --- a/spec.html +++ b/spec.html @@ -48,14 +48,17 @@
The `fromAsync` function is an intentionally generic factory method; it does not require that its *this* value be the Array constructor. Therefore it can be transferred to or inherited by any other constructors that may be called with a single numeric argument.
+This section is a wholly new subsection of the original + Properties of the %TypedArray% Intrinsic Object clause, to be inserted before the %TypedArray%.from + clause.
+When the `fromAsync` method is called, the following steps are taken:
+The `fromAsync` function is an intentionally generic factory method; it does not require that its *this* value be the Array constructor. Therefore it can be transferred to or inherited by any other constructors that may be called with a single numeric argument.
-