All Projects → tc39 → Proposal Await.ops

tc39 / Proposal Await.ops

Licence: mit
Introduce await.all / await.race / await.allSettled / await.any to simplify the usage of Promises

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

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].