Skip to content

Instantly share code, notes, and snippets.

@PabloAlexandre
Last active March 9, 2018 01:32
Show Gist options
  • Select an option

  • Save PabloAlexandre/f1355b42bf20baeafa72b5962540449f to your computer and use it in GitHub Desktop.

Select an option

Save PabloAlexandre/f1355b42bf20baeafa72b5962540449f to your computer and use it in GitHub Desktop.
Functional Programming Composition that accepts Promise
export default (...args) => {
return args.reduce((a, it) => (...params) => {
const d = it(...params);
if(d.then) return d.then(a);
else return a(d);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment