Posted By

jofan on 12/28/10


Tagged

js util curry


Versions (?)

JavaScript Curry


 / Published in: JavaScript
 

URL: curry

From JavaScript Patterns

  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. }

Report this snippet  

You need to login to post a comment.