From 95eb8810b66d2c9e9caf5c5ebb83936867a46ed7 Mon Sep 17 00:00:00 2001 From: Tobias Beer Date: Wed, 11 Feb 2015 19:35:05 +0100 Subject: [PATCH] removed pushOnce --- boot/boot.js | 9 --------- core/modules/filters/each.js | 7 +++++-- 2 files changed, 5 insertions(+), 11 deletions(-) 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); + } } ); }