Last active
November 21, 2023 09:10
-
-
Save ethansnow2012/22a116f44c722170d8f50ffebe376868 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
/** | |
* currying wrapper function that is magical | |
**/ | |
function curry(f) { | |
function curried(args) { | |
if (args.length >= f.length) return f(...args); | |
return accumulator; | |
function accumulator(a) { | |
return curried([...args, a]); | |
}; | |
}; | |
return curried([]); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment