Skip to content

Instantly share code, notes, and snippets.

@devsnek
Created December 11, 2016 04:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devsnek/77ab4b651ce3e298c0b8857e7e135c53 to your computer and use it in GitHub Desktop.
Save devsnek/77ab4b651ce3e298c0b8857e7e135c53 to your computer and use it in GitHub Desktop.
asyncawait's applyEachSeries but with each shitty dependency replaced with native code
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