Created
March 25, 2013 17:39
-
-
Save briancavalier/5238972 to your computer and use it in GitHub Desktop.
Wait for all promises to settle
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 settleAll(array) { | |
return when(array, function(array) { | |
var i, len, results; | |
results = []; | |
for(i = 0, len = array.length; i < len; i++) { | |
if(i in array) { | |
results[i] = when(array[i], null, identity); | |
} | |
} | |
return results; | |
}, function() { | |
return array; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment