mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-28 11:00:27 +00:00
added $tw.utils.pushOnce
retained check for basic each nonetheless tests pass
This commit is contained in:
parent
843f18dc7e
commit
71968e0973
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user