Skip to content

Instantly share code, notes, and snippets.

@karlhorky
Last active May 28, 2016 11:21
Show Gist options
  • Save karlhorky/927d986ecd0adf225533f952ff85cf75 to your computer and use it in GitHub Desktop.
Save karlhorky/927d986ecd0adf225533f952ff85cf75 to your computer and use it in GitHub Desktop.
function getOrderDetails(orderID) {
return db.find( "orders", orderID ).then(order =>
db.find( "customers", order.customerID ).then(customer => ({order, customer}))
).then(({order, customer}) =>
Object.assign(order, {customer})
);
}
getOrderDetails( 1234 )
.then( displayOrder, showError );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment