Created
May 7, 2015 17:14
-
-
Save darthmall/6330be88f3089427cf37 to your computer and use it in GitHub Desktop.
Callbacks for Promise.all with and without lodash.spread
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
// Without lodash | |
function doSomething(results) { | |
var fooResult = results[0]; | |
var barResult = results[1]; | |
} | |
Promise.all([foo, bar]).then(doSomething); | |
// With lodash | |
function doSomething(fooResult, barResult) { | |
} | |
Promise.all([foo, bar]).then(_.spread(doSomething)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment