Skip to content

Instantly share code, notes, and snippets.

@samthomson
Created January 27, 2021 16:17
Show Gist options
  • Save samthomson/0b3503212a3c76274db49285bd6d2f14 to your computer and use it in GitHub Desktop.
Save samthomson/0b3503212a3c76274db49285bd6d2f14 to your computer and use it in GitHub Desktop.
convert colleciton in to promises so that they can be awaited reliably
await Promise.all(
collection.map(async (item) => {
await doSomethingWith(item)
}),
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment