Skip to content

Instantly share code, notes, and snippets.

@SinisterLight
Created May 30, 2013 12:56
Show Gist options
  • Save SinisterLight/5677627 to your computer and use it in GitHub Desktop.
Save SinisterLight/5677627 to your computer and use it in GitHub Desktop.
Standard JS helpers
function asyncForEach(array, iterator, then) {
function loop(i) {
if (i < array.length) {
iterator(array[i], function() {
loop(i + 1);
}
else {
then();
}
}
loop(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment