Created
May 28, 2016 06:56
-
-
Save tuan/9b2e20f293469ee3b215d4ef123cfd48 to your computer and use it in GitHub Desktop.
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
let pipe = (value, ...funs) => { | |
return funs.reduce((accumulator, currentFun) => currentFun(accumulator), value); | |
} | |
let add1 = x => x + 1; | |
let multiply2 = x => x * 2; | |
pipe(10, add1, add1, multiply2, console.log); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment