Skip to content

Instantly share code, notes, and snippets.

@xiaoda
Created January 27, 2016 13:20
Show Gist options
  • Save xiaoda/8540b0ef474b2bf55268 to your computer and use it in GitHub Desktop.
Save xiaoda/8540b0ef474b2bf55268 to your computer and use it in GitHub Desktop.
Function.prototype.method = function (name, func) {
this.prototype[name] = func;
return this;
}
Function.method('curry', function () {
var slice = Array.prototype.slice,
args = slice.apply(arguments),
that = this;
return function () {
return that.apply(null, args.concat(slice.apply(arguments)));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment