root / trunk / web / dojo / dojox / lang / functional / util.js @ 10
History | View | Annotate | Download (821 Bytes)
1 |
/*
|
---|---|
2 |
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
3 |
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
4 |
see: http://dojotoolkit.org/license for details
|
5 |
*/
|
6 |
|
7 |
|
8 |
if(!dojo._hasResource["dojox.lang.functional.util"]){ |
9 |
dojo._hasResource["dojox.lang.functional.util"]=true; |
10 |
dojo.provide("dojox.lang.functional.util");
|
11 |
dojo.require("dojox.lang.functional.lambda");
|
12 |
(function(){
|
13 |
var df=dojox.lang.functional;
|
14 |
dojo.mixin(df,{inlineLambda:function(_1,_2,_3){ |
15 |
var s=df.rawLambda(_1);
|
16 |
if(_3){
|
17 |
df.forEach(s.args,_3); |
18 |
} |
19 |
var ap=typeof _2=="string",n=ap?s.args.length:Math.min(s.args.length,_2.length),a=new Array(4*n+4),i,j=1; |
20 |
for(i=0;i<n;++i){ |
21 |
a[j++]=s.args[i]; |
22 |
a[j++]="=";
|
23 |
a[j++]=ap?_2+"["+i+"]":_2[i]; |
24 |
a[j++]=",";
|
25 |
} |
26 |
a[0]="("; |
27 |
a[j++]="(";
|
28 |
a[j++]=s.body; |
29 |
a[j]="))";
|
30 |
return a.join(""); |
31 |
}}); |
32 |
})(); |
33 |
} |