Skip to content

Instantly share code, notes, and snippets.

@N8python
Created June 23, 2019 11:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save N8python/98c3a2ad823a0e98a04ac08014c8ad5c to your computer and use it in GitHub Desktop.
Save N8python/98c3a2ad823a0e98a04ac08014c8ad5c to your computer and use it in GitHub Desktop.
An asynchronous, concurrent function for creating efficient, easy-to-understand promise pipelines.
async function fmait(callbacks, array) {
for (const callback of callbacks) {
array = await Promise.all(array.map(item => Promise.resolve(callback(item))));
}
return array;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment