Created
April 19, 2019 04:06
-
-
Save flintinatux/f053d37691799044e35516a066ec43a6 to your computer and use it in GitHub Desktop.
Tiny function composition!
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
const compose = (...fs) => x => { | |
let i = fs.length | |
while(i--) x = fs[i](x) | |
return x | |
} |
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
const pipe = (...fs) => x => { | |
let i = -1 | |
while(++i < fs.length) x = fs[i](x) | |
return x | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment