Intent to Ship Array.fromAsync

66 views
Skip to first unread message

Matthew Gaudet

unread,
May 18, 2023, 5:33:56 PM5/18/23
to dev-pl...@mozilla.org

*Summary*: In Bug 1795816 I intend to ship Array.fromAsync as part of Firefox Nightly 115 and let it ride the trains to release.

As a reminder,  `Array.fromAsync` is a TC39 proposal [1] at Stage 3 of the TC39 standardization process [2]. It is the async sibling to `Array.from`, adapted to handle async iterators and promise-returning functions.

It allows the construction of an array of results from an async iterator, returning a promise for this array. Thus,

```
array = []
for await (x of asyncIter) {
  array.push(await x);
}
```

can be simplified to `array = await Array.asyncFrom(asyncIter)`.

We expect some editorial changes to the specification, but no user visible changes.
 
Meta Bug: [https://bugzilla.mozilla.org/show_bug.cgi?id=1746209](https://bugzilla.mozilla.org/show_bug.cgi?id=1746209)  
Specification: [https://tc39.es/proposal-array-from-async/](https://tc39.es/proposal-array-from-async/)  
Platform Coverage: All  
Documentation:  https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fromAsync  

 
Other Browsers: Safari Technical Preview has shipped; Chrome has a flagged implementation.  
Testing: Tested through our tests as well as the ECMAScript standard test suite test262.
Reply all
Reply to author
Forward
0 new messages