Skip to content

Instantly share code, notes, and snippets.

@vitkon
Created May 9, 2017 07:30
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 vitkon/3582e987c803730a70afae47302d52f1 to your computer and use it in GitHub Desktop.
Save vitkon/3582e987c803730a70afae47302d52f1 to your computer and use it in GitHub Desktop.
Simple composition in ES6
const pipe = (...fns) => x => fns.reduce((acc, fn) => fn(acc), x);
pipe(g, f)(20); // 42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment