Created
September 12, 2020 12:11
-
-
Save lilywang711/912bbf29694e0d695b3384b411987257 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
const pipe = (...fns) => (input) => fns.reduce((acc, fn) => fn(acc), input); | |
const addOne = (x) => x + 1; | |
const square = (x) => x * x; | |
console.log(pipe(addOne, square)(2)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment