Last active
June 14, 2020 16:27
-
-
Save CodHeK/2bef85986f1d50b87506d8611710b295 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
const curry = (func) => { | |
const arity = func.length; // number of arguments | |
return build = (...args) => { | |
if(args.length >= arity) { // (1) | |
return func(...args); // (3) | |
} | |
else { | |
return build.bind(null, ...args); // (2) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment