Skip to content

Instantly share code, notes, and snippets.

@Axighi
Created March 21, 2017 09:56
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 Axighi/d92b45d926cac163156761bada341d48 to your computer and use it in GitHub Desktop.
Save Axighi/d92b45d926cac163156761bada341d48 to your computer and use it in GitHub Desktop.
Function.prototype.curry = function() {
if (arguments.length < 1) {
return this;
}
const self = this;
const args = toArray(arguments);
return function() {
return self.apply(this, args.concat(toArray(arguments)));
}
}
function toArray(args) {
return Array.prototype.slice.call(args);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment