Created
March 21, 2017 09:56
-
-
Save Axighi/d92b45d926cac163156761bada341d48 to your computer and use it in GitHub Desktop.
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() { | |
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