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)