JavaScript Curry


/ Published in: JavaScript
Save to your folder(s)

From JavaScript Patterns


Copy this code and paste it in your HTML
  1. function curry(fn) {
  2. var slice = Array.prototype.slice,
  3. stored_args = slice.call(arguments, 1);
  4. return function () {
  5. var new_args = slice.call(arguments),
  6. args = stored_args.concat(new_args);
  7. return fn.apply(null, args);
  8. };
  9. }

URL: curry

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.