Created
May 30, 2013 12:56
-
-
Save SinisterLight/5677627 to your computer and use it in GitHub Desktop.
Standard JS helpers
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 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