Created
December 12, 2017 19:29
-
-
Save alersenkevich/e3a9493dc0ed77d3f70782cfca92cc16 to your computer and use it in GitHub Desktop.
compose FP
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 = (...args) => (...currentArgs) => { | |
let result = args[0](...currentArgs) | |
for (let i = 0; i < currentArgs.length; i++) { | |
result = args[i + 1](result) | |
} | |
return result | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment