Skip to content

Instantly share code, notes, and snippets.

@alersenkevich
Created December 12, 2017 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alersenkevich/e3a9493dc0ed77d3f70782cfca92cc16 to your computer and use it in GitHub Desktop.
Save alersenkevich/e3a9493dc0ed77d3f70782cfca92cc16 to your computer and use it in GitHub Desktop.
compose FP
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