mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-06-28 08:13:14 +00:00
removed conditional from iterator
I'd really like to see a profiler run against the two to see the performance impact of one over the other
This commit is contained in:
parent
c3cbbc3f66
commit
a88ead9c0f
|
@ -19,21 +19,31 @@ Export our filter function
|
||||||
exports.each = function(source,operator,options) {
|
exports.each = function(source,operator,options) {
|
||||||
var results = [],
|
var results = [],
|
||||||
values = {},
|
values = {},
|
||||||
list = "list" === operator.suffix;
|
field = operator.operand || "title",
|
||||||
|
add = function(v) {
|
||||||
|
if(!$tw.utils.hop(values,v)) {
|
||||||
|
values[v] = true;
|
||||||
|
results.push(v);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if("list" !== operator.suffix) {
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
if(tiddler) {
|
if(tiddler) {
|
||||||
var field = operator.operand || "title",
|
add("title" === field ? title : tiddler.getFieldString(operator.operand));
|
||||||
items = list ?
|
}
|
||||||
options.wiki.getTiddlerList(title,field) :
|
});
|
||||||
[ "title" === field ? title : tiddler.getFieldString(operator.operand)];
|
} else {
|
||||||
$tw.utils.each(items,function(value){
|
source(function(tiddler,title) {
|
||||||
if(!$tw.utils.hop(values,value)) {
|
if(tiddler) {
|
||||||
values[value] = true;
|
$tw.utils.each(
|
||||||
results.push(list ? value : title);
|
options.wiki.getTiddlerList(title,field),
|
||||||
|
function(value) {
|
||||||
|
add(value);
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user