套用curry

 1 Function.prototype.method = function(name, func) {
 2     if (!this.prototype[name]) {
 3         this.prototype[name] = func;
 4     }
 5 };
 6 
 7 Function.method('curry', function() {
 8     var slice = Array.prototype.slice,
 9         args = slice.apply(arguments),
10         that = this;
11     return function() {
12         return that.apply(null, args.concat(slice.apply(arguments)));
13     };
14 });

 

posted @ 2012-07-12 12:30  小猩猩君  阅读(128)  评论(0编辑  收藏  举报