Last active
August 29, 2015 14:10
-
-
Save djtriptych/7260910a5b32a572cfad to your computer and use it in GitHub Desktop.
Javascript autocurry
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
var autocurry = function (f) { | |
return function () { | |
var args = Array.prototype.slice.call(arguments, 0); | |
return args.length < f.length ? | |
autocurry(args.reduce(function (g, arg) {return g.bind(null, arg)}, f)) : | |
f.apply(null, args); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment