Skip to content

Instantly share code, notes, and snippets.

@CodHeK
Last active June 14, 2020 16:27
Show Gist options
  • Save CodHeK/2bef85986f1d50b87506d8611710b295 to your computer and use it in GitHub Desktop.
Save CodHeK/2bef85986f1d50b87506d8611710b295 to your computer and use it in GitHub Desktop.
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