Nodejs Array In isIn(key, value)

Here you can find the source of isIn(key, value)

Method Source Code

Array.prototype.isIn = function(key, value) {
    for(var i =0; i<this.length; i++) {
        if(this[i][key] == value) {
            return true;
        }/*from w ww  .ja v  a  2  s.  c  o  m*/
    }
    return false;
};

Related

  1. in_array(entity)
    Array.prototype.in_array = function(entity) {
        for (var idx in this) {
            if (this[idx] === entity)
                return true;
        return false;
    };
    
  2. in_array(needle)
    Array.prototype.in_array = function(needle) {
      for (var i = 0; i < this.length; i++)
        if (this[i] === needle)
          return true;
      return false;
    
  3. in_array(value)
    Array.prototype.in_array = function (value) {
      return (this.indexOf(value) !== -1);
    };
    
  4. in_array(value)
    Array.prototype.in_array = function(value){
        var len = this.length,
            i;
        for(i = 0;i < len;i+=1){
            if(this[i] === value) return i;
        return false;
    
  5. in_array(value, caseSensitive)
    Array.prototype.in_array = function(value, caseSensitive)
      for(var i=0; i < this.length; i++)
        if(caseSensitive)
          if(this[i].toLowerCase() == value.toLowerCase())
            return true;
    ...
    
  6. isInArray(elem)
    Array.prototype.isInArray = function (elem) {
        for (i = 0, len = this.length; i < len; i++) {
            if (this[i] == elem) {
                return true;
        return false;