Changeset 7563

Show
Ignore:
Timestamp:
03/09/07 02:18:43 (22 months ago)
Author:
alex
Message:

refs #2414

applying the bits of Josh Staiger's patch that can be safely used in 0.4.x code. Will apply the full patch to trunk, but I'll be counting on Josh or Adam to fill in the porting guide for this function

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/0.4/src/lang/array.js

    r6734 r7563  
    9494                //              returns 10 
    9595                var reducedValue = initialValue; 
    96                 if(arguments.length == 1){ 
    97                         dojo.debug("dojo.lang.reduce called with too few arguments!"); 
    98                         return false; 
    99                 }else if(arguments.length == 2){ 
     96                if(arguments.length == 2){ 
    10097                        binary_func = initialValue; 
    101                         reducedValue = arr.shift(); 
    102                 }else if(arguments.lenght == 3){ 
     98                        reducedValue = arr[0]; 
     99                        arr = arr.slice(1); 
     100                }else if(arguments.length == 3){ 
    103101                        if(dojo.lang.isFunction(obj)){ 
    104102                                binary_func = obj; 
     
    117115                } 
    118116 
    119                 var ob = obj ? obj : dj_global; 
     117                var ob = obj || dj_global; 
    120118                dojo.lang.map(arr,  
    121119                        function(val){