Created
January 24, 2018 22:05
-
-
Save alaboudi/852b9acbed189320bcea2c806904e9e9 to your computer and use it in GitHub Desktop.
Function to compose other functions
This file contains 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 = (...fns) => | |
fns.reverse().reduce((prevFn, nextFn) => | |
value => nextFn(prevFn(value)), | |
value => value | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment