Nodejs Utililty Methods Array Push If Not Exist

List of utility methods to do Array Push If Not Exist

Description

The list of methods to do Array Push If Not Exist are organized into topic(s).

Method

pushIfNotExist(element, comparer)
Array.prototype.pushIfNotExist = function(element, comparer) { 
    if (!this.inArray(comparer)) {
        this.push(element);
};
pushIfNotExist(element, comparer)
Array.prototype.pushIfNotExist = function(element, comparer) { 
    if (!this.inArray(comparer)) {
        this.push(element);
};
pushIfNotExist(element, comparer)
Array.prototype.pushIfNotExist = function(element, comparer) { 
    if (!this.inArray(comparer)) {
        this.push(element);
}; 
function arrayObjectIndexOf(myArray, property, searchTerm) {
    for(var i = 0, len = myArray.length; i < len; i++) {
        if (myArray[i][property] === searchTerm) return i;
    return -1;
pushIfNotExist(element, comparer)
Array.prototype.pushIfNotExist = function(element, comparer) { 
    if (!this.inArray(comparer)) {
        this.push(element); 
        return true;
    return false;
}; 
function arrayObjectIndexOf(myArray, property, searchTerm) {
    for(var i = 0, len = myArray.length; i < len; i++) {
...
pushIfNotExist(item)
Array.prototype.pushIfNotExist = function (item) {
    if (item == null)
        return;
    var exist = false;
    for (var i = 0; i < this.length; i++) {
        if (this[i] == item) {
            exist = true;
            break;
    if (!exist)
        this.push(item);
};
pushIfNotExist(item)
Array.prototype.pushIfNotExist = function(item) {
  if (!this.inArray(item)) {
    this.push(item);
};
pushIfNotPresent(pValue)
Array.prototype.pushIfNotPresent = function (pValue){
    var lArray = this || [];
    if (lArray.indexOf(pValue) == -1){
        lArray.push(pValue);
        return true;
    return false;