Skip to content

Instantly share code, notes, and snippets.

@darthmall
Created May 7, 2015 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darthmall/6330be88f3089427cf37 to your computer and use it in GitHub Desktop.
Save darthmall/6330be88f3089427cf37 to your computer and use it in GitHub Desktop.
Callbacks for Promise.all with and without lodash.spread
// 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