I have no idea if this has been discussed already but I thought it'd be
nice to have the following syntax sugar for async/await.
The idea would be that any array that follows `await` would be wrapped into
a Promise.all() call. For example, `await [p1,p2]` would be the equivalent
of `await Promise.all([p1,p2])`.
It would make some more complex expressions easier to read:
```
const downloads = await Promise.all(regs.map(reg => client.get(reg.url, {
responseType: 'arraybuffer',
})))
```
vs
```
const downloads = await regs.map(reg => client.get(reg.url, {
responseType: 'arraybuffer',
}))
```
In many async/await code bases, it might remove the last use case for
typing `Promise` directly.
--
- Oli
Oli Lalonde
http://www.syskall.com <-- connect with me!
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss