Created
December 11, 2016 04:17
-
-
Save devsnek/77ab4b651ce3e298c0b8857e7e135c53 to your computer and use it in GitHub Desktop.
asyncawait's applyEachSeries but with each shitty dependency replaced with native code
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
function applyEachSeries(array, ...args) { | |
const iterator = array[Symbol.iterator](); | |
const final = args.pop(); // performance? | |
(function cb() { | |
const x = iterator.next(); | |
if (x.done) return final(); | |
x.value(...args, cb); | |
})(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment