Skip to content

Instantly share code, notes, and snippets.

@JSerZANP
Created August 16, 2020 08:39
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 JSerZANP/01dc55b2ebb10d69a3f7027234837299 to your computer and use it in GitHub Desktop.
Save JSerZANP/01dc55b2ebb10d69a3f7027234837299 to your computer and use it in GitHub Desktop.
bfe.dev-1-solution.js
function curry(func) {
return function curried(...args) {
// 1. if enough args, call func
// 2. if not enough, bind the args and wait for new one
if (args.length >= func.length) {
return func.apply(this, args)
} else {
return curried.bind(this, ...args)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment