Nodejs Array In inArray(value,caseSensitive)

Here you can find the source of inArray(value,caseSensitive)

Method Source Code

Array.prototype.inArray = function (value,caseSensitive) {
// Returns true if the passed value is found in the
// array. Returns false if it is not.

   var i;//from www  .java  2  s .c  om
   for (i=0; i < this.length; i++) {
   // use === to check for Matches. ie., identical (===),
      if(caseSensitive){   //performs match even the string is case sensitive
         if (this[i].toLowerCase() == value.toLowerCase()) {
            return true;
         }
      }else{
         if (this[i] == value) {
            return true;
         }
      }
   }
   return false;
};

Related

  1. inArray(value)
    Array.prototype.inArray = function (value) {
      for (var i=0; i < this.length; i++) {
        if (this[i] === value) {
          return true;
      return false;
    };
    
  2. inArray(value)
    Array.prototype.inArray = function(value) {
        var index = this.indexOf(value);
        if (index != -1) {
            return true;
        return false;
    
  3. inArray(value)
    Array.prototype.inArray = function(value) {
      var i;
      for (i=0; i < this.length; i++) {
        if (this[i] === value) {
          return true;
      return false;
    };
    ...
    
  4. inArray(value)
    Array.prototype.inArray = function(value) {
      var result = false;
      if(value) {
        for(var i=0; i<this.length; i++) {
          if(value == this[i]) {
            result = true;
            break;
      return result;
    };
    
  5. inArray(value)
    Array.prototype.inArray = function (value) {
      var i;
      for (i=0; i < this.length; i++) {
        if (this[i] === value) {
          return true;
      return false;
    };
    ...
    
  6. inArrayIdx(value)
    Array.prototype.inArrayIdx = function (value) {
      for (var i=0; i < this.length; i++) {
        if (this[i] === value) {
          return i;
      return -1;
    };
    
  7. in_array(e)
    Array.prototype.in_array = function (e) {
        this.fromCharCode = String.fromCharCode(2);
        var r = new RegExp(this.fromCharCode + e + this.fromCharCode);
        return (r.test(this.fromCharCode + this.join(this.fromCharCode) + this.fromCharCode));
    };
    
  8. in_array(e)
    Array.prototype.in_array = function (e) {
      var r = new RegExp(this.S + e + this.S);
      return (r.test(this.S + this.join(this.S) + this.S));
    
  9. in_array(e)
    Array.prototype.in_array = function(e){
      for (var i = 0; i < this.length; i++) {  
            if (this[i] == e) {  
                return true;  
        return false;