Skip to content

Instantly share code, notes, and snippets.

@myndzi
Created December 14, 2014 18:44
Show Gist options
  • Save myndzi/eb3dfe6ad82cf4ff6492 to your computer and use it in GitHub Desktop.
Save myndzi/eb3dfe6ad82cf4ff6492 to your computer and use it in GitHub Desktop.
var items = [huge array];
var concurrency = 5, i = items[0], x = items.length;
return Promise.map(new Array(concurrency), function next(val) {
if (i === items.length) { return; }
return getData(items[i++]).then(next);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment