Page Menu
Home
Code
Search
Configure Global Search
Log In
Files
F882183
listcomp.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
937 B
Subscribers
None
listcomp.js
View Options
/*
Copyright (c) 2004-2009, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
if
(
!
dojo
.
_hasResource
[
"dojox.lang.functional.listcomp"
]){
dojo
.
_hasResource
[
"dojox.lang.functional.listcomp"
]
=
true
;
dojo
.
provide
(
"dojox.lang.functional.listcomp"
);
(
function
(){
var
_1
=
/\bfor\b|\bif\b/gm
;
var
_2
=
function
(
s
){
var
_3
=
s
.
split
(
_1
),
_4
=
s
.
match
(
_1
),
_5
=
[
"var r = [];"
],
_6
=
[],
i
=
0
,
l
=
_4
.
length
;
while
(
i
<
l
){
var
a
=
_4
[
i
],
f
=
_3
[
++
i
];
if
(
a
==
"for"
&&!
/^\s*\(\s*(;|var)/
.
test
(
f
)){
f
=
f
.
replace
(
/^\s*\(/
,
"(var "
);
}
_5
.
push
(
a
,
f
,
"{"
);
_6
.
push
(
"}"
);
}
return
_5
.
join
(
""
)
+
"r.push("
+
_3
[
0
]
+
");"
+
_6
.
join
(
""
)
+
"return r;"
;
};
dojo
.
mixin
(
dojox
.
lang
.
functional
,{
buildListcomp
:
function
(
s
){
return
"function(){"
+
_2
(
s
)
+
"}"
;
},
compileListcomp
:
function
(
s
){
return
new
Function
([],
_2
(
s
));
},
listcomp
:
function
(
s
){
return
(
new
Function
([],
_2
(
s
)))();
}});
})();
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 2, 13:35 (3 w, 6 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26477
Default Alt Text
listcomp.js (937 B)
Attached To
rZEDHG ZedLegacy
Event Timeline
Log In to Comment