kopia lustrzana https://github.com/miklobit/TiddlyWiki5
Optimise LinkedList filter ops to return iterator instead of array (#6035)
* filter ops don't LinkedList to array anymore * LL.tiddlerIterator -> LL.makeTiddlerIterator LinkedList method name change.sort-optimisations
rodzic
dcff318a98
commit
e9d8547a81
|
@ -52,7 +52,7 @@ exports.all = function(source,operator,options) {
|
||||||
results.pushTop(subop(source,operator.prefix,options));
|
results.pushTop(subop(source,operator.prefix,options));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return results.toArray();
|
return results.makeTiddlerIterator(options.wiki);
|
||||||
};
|
};
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -20,7 +20,7 @@ exports.links = function(source,operator,options) {
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
results.pushTop(options.wiki.getTiddlerLinks(title));
|
results.pushTop(options.wiki.getTiddlerLinks(title));
|
||||||
});
|
});
|
||||||
return results.toArray();
|
return results.makeTiddlerIterator(options.wiki);
|
||||||
};
|
};
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -95,6 +95,15 @@ LinkedList.prototype.toArray = function() {
|
||||||
return output;
|
return output;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
LinkedList.prototype.makeTiddlerIterator = function(wiki) {
|
||||||
|
var self = this;
|
||||||
|
return function(callback) {
|
||||||
|
self.each(function(title) {
|
||||||
|
callback(wiki.getTiddler(title),title);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
function _removeOne(list,value) {
|
function _removeOne(list,value) {
|
||||||
var prevEntry = list.prev[value],
|
var prevEntry = list.prev[value],
|
||||||
nextEntry = list.next[value],
|
nextEntry = list.next[value],
|
||||||
|
|
Ładowanie…
Reference in New Issue