Skip to content

Instantly share code, notes, and snippets.

@zanonnicola
Created February 6, 2017 10:53
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 zanonnicola/5e55ea3f55dd3f6c225f8abeaf4590fa to your computer and use it in GitHub Desktop.
Save zanonnicola/5e55ea3f55dd3f6c225f8abeaf4590fa to your computer and use it in GitHub Desktop.
Functions piping
const _pipe = (func1, func2) => (...args) => func2(func1(...args));
const pipe = (...funcs) => funcs.reduce(_pipe);
// const myFunc = pipe(add(), double(), triple());
// myFunc(2, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment