Last active
October 11, 2018 22:58
-
-
Save tjjfvi/67c6dbda48db41ae48650c3cb46da57d to your computer and use it in GitHub Desktop.
Promise.sequential(asyncFuncs): Sequentially executes the function and returns Array of results
This file contains 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.sequential = funcs => funcs.reduce((p, fn) => p.then(rs => fn().then(r => [...rs, r])), Promise.resolve([])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment