Remove package bmx6-luci in favor of packages/luci-app-bmx6
[feed/routing.git] / packages / luci-app-bmx6 / files / www / luci-static / resources / bmx6 / js / Curry-1.0.1.js
1 /**
2 * Curry - Function currying
3 * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
4 * Licensed under BSD (http://www.opensource.org/licenses/bsd-license.php)
5 * Date: 10/4/2008
6 *
7 * @author Ariel Flesler
8 * @version 1.0.1
9 */
10
11 function curry( fn ){
12 return function(){
13 var args = curry.args(arguments),
14 master = arguments.callee,
15 self = this;
16
17 return args.length >= fn.length ? fn.apply(self,args) : function(){
18 return master.apply( self, args.concat(curry.args(arguments)) );
19 };
20 };
21 };
22
23 curry.args = function( args ){
24 return Array.prototype.slice.call(args);
25 };
26
27 Function.prototype.curry = function(){
28 return curry(this);
29 };