Skip to content

Instantly share code, notes, and snippets.

@ksnabb
Created April 30, 2021 15:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ksnabb/f33097771bd371397e21f86b3cdac599 to your computer and use it in GitHub Desktop.
Save ksnabb/f33097771bd371397e21f86b3cdac599 to your computer and use it in GitHub Desktop.
variadic curry
function curry(f) {
return function curried(...args) {
if (args.length >= f.length) {
return f.apply(this, args);
} else {
return function (...args2) {
return curried.apply(this, args.concat(args2));
};
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment