Last active
March 9, 2018 01:32
-
-
Save PabloAlexandre/f1355b42bf20baeafa72b5962540449f to your computer and use it in GitHub Desktop.
Functional Programming Composition that accepts Promise
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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