Skip to content

Instantly share code, notes, and snippets.

@breenie
Created January 18, 2023 09:44
Show Gist options
  • Save breenie/740b61497fc2a456f6c024a501982998 to your computer and use it in GitHub Desktop.
Save breenie/740b61497fc2a456f6c024a501982998 to your computer and use it in GitHub Desktop.
Execute nodejs promises serially
/**
* Ensures a list of promises run in series
* @param {array} funcs - an array of funcs that return promises
* @returns {object}
*/
const series = (funcs) => funcs.reduce((p, f) => p.then(f), Promise.resolve());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment