Created
March 24, 2020 10:33
-
-
Save blackChef/d57b2a44cb7fdf2b0f67b100e3a4f11b to your computer and use it in GitHub Desktop.
Execute async functions one by one, and collect result after all functions are finished
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
// [() => Promise] => Promise | |
const runPromiseFnInOrder = async function(fns) { | |
const ret = []; | |
for (const fn of fns) { | |
const r = await fn(); | |
ret.push(r); | |
} | |
return Promise.resolve(ret); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment