Created
February 6, 2017 10:53
-
-
Save zanonnicola/5e55ea3f55dd3f6c225f8abeaf4590fa to your computer and use it in GitHub Desktop.
Functions piping
This file contains 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 _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