Skip to content

Instantly share code, notes, and snippets.

@flintinatux
Created April 19, 2019 04:06
Show Gist options
  • Save flintinatux/f053d37691799044e35516a066ec43a6 to your computer and use it in GitHub Desktop.
Save flintinatux/f053d37691799044e35516a066ec43a6 to your computer and use it in GitHub Desktop.
Tiny function composition!
const compose = (...fs) => x => {
let i = fs.length
while(i--) x = fs[i](x)
return x
}
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