Here you can find the source of pushUnique(item)
Array.prototype.pushUnique = function (item) { if (this.indexOf(item) == -1) { this.push(item);//from w ww. ja v a2s. c o m return true; } return false; }; String.prototype.repeat = function (num) { return new Array(num + 1).join(this); }; function toBool(s, defValue) { if (typeof s === "undefined") { return typeof defValue !== "undefined" ? defValue : false; } return "false" !== s; } if (typeof String.prototype.endsWith !== 'function') { String.prototype.endsWith = function (suffix) { return this.indexOf(suffix, this.length - suffix.length) !== -1; }; } if (typeof String.prototype.startsWith !== 'function') { String.prototype.startsWith = function (str) { return this.indexOf(str) == 0; }; }
Array.prototype.pushIfUnique = function(entryIn){ var arr = this; var unique = true; arr.forEach(function(entry){ if(entryIn === entry){ unique = false; }); if(unique){ ...
Array.prototype.pushUniq = function(el, test) { if (test == null) { if (this.indexOf(el) < 0) { this.push(el); return true; return false; for (var i = this.length; --i >= 0;) ...
Array.prototype.pushUnique = function(item){ if(this.indexOf(item) === -1) this.push(item);
Array.prototype.pushUnique = function (item){ if(this.indexOf(item) === -1) { this.push(item); return true; return false; };
Array.prototype.pushUnique = function(item,unique) if(unique === false) { this.push(item); } else { if(this.indexOf(item) == -1) this.push(item); }; ...
Array.prototype.pushUnique = function(k, v) { exist = false; for(var i = 0; i < this.length; i++) { if (this[i][k] == v) return this[i]; if (!exist) { obj = {}; obj[k] = v; this.push(obj); ...
Array.prototype.pushUnique=function(obj){ if(this.containsObject(obj)){ return; this.push(obj);
Array.prototype.pushUnique = function (obj, equalityFunction) { equalityFunction = (typeof equalityFunction === "undefined") ? function(a, b) { return a === b } : equalityFunction; for(var n = 0; n < this.length; n++) { if(equalityFunction(this[n], obj)) { return false; this.push(obj); return true; ...