Nodejs Array Has Object hasObjectExists(item)

Here you can find the source of hasObjectExists(item)

Method Source Code

Array.prototype.hasObjectExists = function(item) {
    for (i = 0; i < this.length; i++) {
        if(this[i].id == item.id){
            return true;
        }/*from w w w .j a  v  a2s  .  c  o m*/
    }
    return false;
};

Related

  1. hasObject(
    Array.prototype.hasObject = (
      !Array.indexOf ? function (o)
        var l = this.length + 1;
        while (l -= 1)
            if (this[l - 1] === o)
                return true;
    ...
    
  2. hasObject(o)
    Array.prototype.hasObject = function (o)
        var l = this.length + 1;
        while (l -= 1)
            if (this[l - 1].name === o.name)
                return true;
        return false;
    
  3. hasObject(o)
    Array.prototype.hasObject = (!Array.indexOf ? function (o) {
      var l = this.length + 1;
      while (l--) {
        if (this[l - 1] === o) {
          return true;
      return false;
    } : function (o) {
    ...