Skip to content

Instantly share code, notes, and snippets.

@luggage66
Created October 14, 2015 18:25
Show Gist options
  • Save luggage66/19c17f83617b908c6268 to your computer and use it in GitHub Desktop.
Save luggage66/19c17f83617b908c6268 to your computer and use it in GitHub Desktop.
function getSpecialData(arg1) {
return someDbCall(arg1)
.then((result) => {
if (result.isComplete) {
return result;
}
else {
return someOtherDbCall(result.foo);
}
});
}
return foo
.then(getSpecialData) //this is what I mean by composing.
.then(bar);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment