~tempo-openerp/+junk/loewert-prod

« back to all changes in this revision

Viewing changes to web/addons/web_diagram/static/lib/js/Curry-1.0.1.js

  • Committer: jbe at tempo-consulting
  • Date: 2013-08-21 08:48:11 UTC
  • Revision ID: jbe@tempo-consulting.fr-20130821084811-913uo4l7b5ayxq8m
[NEW] Création de la branche trunk Loewert

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
};
 
 
b'\\ No newline at end of file'