Created
January 18, 2023 09:44
-
-
Save breenie/740b61497fc2a456f6c024a501982998 to your computer and use it in GitHub Desktop.
Execute nodejs promises serially
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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