diff --git a/boot/boot.js b/boot/boot.js index 56742c89d..acdfa0327 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -84,15 +84,6 @@ $tw.utils.each = function(object,callback) { } }; -/* -Pushes a value to an array only when not yet contained. -*/ -$tw.utils.pushOnce = function(array,value) { - if(array.indexOf(value) == -1) { - array.push(value); - } -} - /* Helper for making DOM elements tag: tag name diff --git a/core/modules/filters/each.js b/core/modules/filters/each.js index cd7584323..c60447446 100644 --- a/core/modules/filters/each.js +++ b/core/modules/filters/each.js @@ -29,14 +29,17 @@ exports.each = function(source,operator,options) { results.push(title); } } - }); + }); } else { source(function(tiddler,title) { if(tiddler) { $tw.utils.each( options.wiki.getTiddlerList(title,field), function(value) { - $tw.utils.pushOnce(results,value); + if(!$tw.utils.hop(values,value)) { + values[value] = true; + results.push(value); + } } ); }