Nodejs Array Contain contains( func)

Here you can find the source of contains( func)

Method Source Code

Array.prototype.contains = function( func) {
   if( $.isFunction(func) ) {
      for( var i=0; i<this.length; i++ ) {
         var item = this[i];
         if( func(item) == true ) {
            return true;
         }//from   w w  w  .  ja v  a2  s. c  o  m
      }
      return false;
   }
   else {
      console.log("Please pass a function when using find","Error");
   }
};

Related

  1. contain(arg)
    Array.prototype.contain = function(arg){
      var i=0;
      var arrSize = this.length;
      for(i=0;i<arrSize;i++){
        if(this[i] == arg){
          return true;
      return false;
    ...
    
  2. contain(obj)
    Array.prototype.contain = function(obj){
      for(var i=0;i<this.length;i++){
        if(this[i]==obj){
          return true;
      return false;
    };
    
  3. contains( needle )
    Array.prototype.contains = function ( needle ) {
        for (i in this) {
            if (this[i] == needle) return true;
        return false;
    
  4. contains( needle )
    Array.prototype.contains = function ( needle ) {
       for (i in this) {
           if (this[i] == needle) return true;
       return false;
    
  5. contains( needle )
    Array.prototype.contains = function ( needle ) {
       for (i in this) {
           if (this[i] === needle) return true;
       return false;
    
  6. contains( v )
    Array.prototype.contains = function( v ) {
      for ( var i = 0, l = this.length; i < l; i++ ) { 
        if ( this[ i ] === v ) return true; 
      return false;