Created
May 9, 2016 20:29
-
-
Save towerz/2542e9d18d6f1e4b8e3a2c7560ac6fac to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function curry(fn) { | |
return function curriedFn(...args) { | |
if (args.length === fn.length) { | |
return fn(...args) | |
} | |
return (x) => curriedFn(...[...args, x]) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment