Skip to content

Instantly share code, notes, and snippets.

@matsko
Created September 1, 2014 15:08
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 matsko/ba0ccfa5719432f0f54a to your computer and use it in GitHub Desktop.
Save matsko/ba0ccfa5719432f0f54a to your computer and use it in GitHub Desktop.
function append(prop, promise) {
return function(book) {
promise.then(function(data) {
book[prop] = data;
})
}
};
var requests = [];
var book = bookQuery(isbnQuery(code))
requests[0] = book.then(append('works', worksQuery))
requests[1] = book.then(append('authors', authorsQuery))
return $q.all(requests);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment