Guest User

Untitled

a guest
Jun 21st, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. function curry(func) {
  2. if (typeof func !== 'function') throw new TypeError('`func` must be Function type');
  3.  
  4. var context = this;
  5. var _curry = function (f, args) {
  6. var arity = f.length;
  7.  
  8. return function () {
  9. Array.prototype.push.apply(args, arguments);
  10. return args.length >= arity ? f.apply(context, args) : _curry(f, args);
  11. };
  12. };
  13.  
  14. return _curry(func, []);
  15. }
Add Comment
Please, Sign In to add comment