Created
May 29, 2020 13:42
-
-
Save lantosgyuri/60e9e4daa309a2d4b3906cb53ce4ed7e 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 createAdder = (base) => (secondary) => secondary + base; | |
const numbers = [1,2,3,4,5]; | |
const fns = numbers.map(item => createAdder(item)); | |
const pipe = (...fns) => x => fns.reduce((y, f) => f(y), x); | |
const addAll = pipe(...fns); | |
// console.log(addAll(6)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment