Created
July 7, 2018 13:04
-
-
Save JamieDixon/05263ad16dc6320cde09808bcd26deb6 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 curry = fn => function innerCurry(...args) { | |
return args.length >= fn.length ? fn(...args) : innerCurry.bind(null, ...args); | |
} | |
const foo = curry((a, b, c) => a + b + c); | |
foo(1, 2, 3); // 6 | |
foo(1)(2, 3); // 6 | |
foo(1, 2)(3); // 6 | |
foo(1)(2)(3) // 6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment