Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function curry(func) {
- if (typeof func !== 'function') throw new TypeError('`func` must be Function type');
- var context = this;
- var _curry = function (f, args) {
- var arity = f.length;
- return function () {
- Array.prototype.push.apply(args, arguments);
- return args.length >= arity ? f.apply(context, args) : _curry(f, args);
- };
- };
- return _curry(func, []);
- }
Add Comment
Please, Sign In to add comment