Created
April 3, 2020 15:50
-
-
Save kurdin/d17916de5d027af6932285818d0f588f to your computer and use it in GitHub Desktop.
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
tryES6.com/9WS4pMfJT | |
function runSerial(tasks, fn) { | |
return tasks.reduce((promise, task) => promise.then(previous => fn(task, previous)), Promise.resolve(null)) | |
} | |
function runParallel(tasks, fn) { | |
return Promise.all(tasks.map(task => fn(task))) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment