From 71968e09733753ce0e7d8a03f51ffeed768437d7 Mon Sep 17 00:00:00 2001 From: Tobias Beer Date: Tue, 27 Jan 2015 19:31:23 +0100 Subject: [PATCH] added $tw.utils.pushOnce retained check for basic each nonetheless tests pass --- boot/boot.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/boot/boot.js b/boot/boot.js index acdfa0327..68eb80799 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -84,6 +84,15 @@ $tw.utils.each = function(object,callback) { } }; +/* +Pushes a value to an array only when not yet contained. +*/ +$tw.utils.pushOnce = function(array,value) { + if(0 > array.indexOf(value)){ + array.push(value); + } +} + /* Helper for making DOM elements tag: tag name