Last active
December 19, 2015 17:39
-
-
Save phil303/5992925 to your computer and use it in GitHub Desktop.
curry method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function.prototype.curry = function () { | |
var fn = this, args = Array.prototype.slice.call(arguments); | |
return function () { | |
return fn.apply(this, args.concat(Array.prototype.slice.call(arguments))); | |
}; | |
}; | |
var add = (function(a, b) { return a +b; }).curry(2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment