tc39 / Proposal Await.ops
Licence: mit
Introduce await.all / await.race / await.allSettled / await.any to simplify the usage of Promises
Stars: ✭ 100
Labels
await.ops proposal
The rendered spec text. Playground Link
Introduce await.all / await.race / await.allSettled / await.any to simplify the usage of Promises
Stage: 1
Champions: Jack Works, Jordan Harband
Motivation
- To simplify the usage of a set of Promises. (Previous discussions: https://es.discourse.group/t/allow-awaiting-on-arrays/178/19)
- To simplify the usage of concurrent for loop in async functions.
Usage:
// before
await Promise.all(users.map(async x => fetchProfile(x.id)))
// after
await.all users.map(async x => fetchProfile(x.id))
Syntax:
await.all expr
// eq: await Promise.all(expr)
await.race expr
// eq: await Promise.race(expr)
await.allSettled expr
// eq: await Promise.allSettled(expr)
await.any expr
// eq: await Promise.any(expr)
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].