Nodejs Array Contain contains(e,ignore)

Here you can find the source of contains(e,ignore)

Method Source Code

Array.prototype.contains  = function(e,ignore)  {  
   if(ignore==undefined) ignore = false;
    for(var i=0;i<this.length;i++){  
      if(ignore){
         if(this[i].toLowerCase() == e.toLowerCase()) 
            return true; 
      }else{//from   w  w w .j  av  a 2s  .c om
         if(this[i] == e) 
            return true; 
      }            
    }  
    return false;  
}

Related

  1. contains(array)
    Array.prototype.contains = function(array) {
      var arr1 = this.sort();
      var arr2 = array.sort();
      var i = arr1.length;
      if ( i < arr2.length ) {
        return false;
      while (i--) {
        if (arr1[i] === arr2[i]) {
    ...
    
  2. contains(array)
    Array.prototype.contains = function (array) {
        var debug = true;
        var starts = [];
        for (var i = 0; i < this.length; i++) {
      if (this[i] == array[0])
          starts.push(i);
        console.log('found', starts.length, 'possible matches');
        for (var p = 0; p < starts.length; p++) {
    ...
    
  3. contains(array, sizediff)
    var fs =require('fs');
    var lineReader = require('line-reader');
    Array.prototype.contains = function (array, sizediff) {
        if (!array)
            return false;
        if (this.length <= array.length)
            return false;
      if (sizediff && this.length > array.length + sizediff)
        return false;
    ...
    
  4. contains(e)
    Array.prototype.contains = function (e) {
        return this.indexOf(e) > -1;
    };
    
  5. contains(e)
    Array.prototype.contains = function(e) {
        for (var i = this.length - 1; i >= 0; i--) {
            if (this[i] == e) {
                return true;
        return false;
    };
    
  6. contains(el)
    "use strict";
    Array.prototype.contains = function(el){
      return this.indexOf(el) > -1;
    };
    var rotateArray = function rotateArray(arr){ 
      arr.unshift(arr.pop());
      return arr;
    };
    print(function(input){ 
    ...
    
  7. contains(el)
    Array.prototype.contains = function(el) {
      for(var i = 0; i < this.length; i++) {
        if(this[i] === el) {
          return true;
      return false;
    };
    
  8. contains(el, test)
    Array.prototype.contains = function(el, test) {
        if (test == null) return this.indexOf(el) >= 0;
        for (var i = this.length; --i >= 0;) if (test(this[i], el)) return true;
    };
    
  9. contains(ele)
    Array.prototype.contains = function(ele) {
      for (var i = 0; i < this.length; i++) {
        if (this[i] === ele) return true;
      return false;
    };
    Array.prototype.clear = function() {
      var cnt = this.length;
      this.splice(0, cnt);
    ...