Nodejs String Contains contains(subString)

Here you can find the source of contains(subString)

Method Source Code

String.prototype.contains = function (subString) {
   return this.indexOf(subString) !== -1;
};

Related

  1. contains(string)
    String.prototype.contains = function(string) {
        return this.indexOf(string) > -1;
    };
    
  2. contains(string, index)
    String.prototype.contains = function (string, index) {
      return this.indexOf(string, index) !== -1;
    };
    
  3. contains(string, index)
    String.prototype.contains = function (string, index) {
      return this.indexOf(string, index) !== -1;
    };
    
  4. contains(stringSet)
    String.prototype.contains = function(stringSet) {
      for (var i=0;i<stringSet.length;i++) {
         if (this.indexOf(stringSet[i]) >= 0)
            return true;
      return false;
    };
    
  5. contains(strings, index)
    String.prototype.contains = function(strings, index) {
      if(!Array.isArray(strings)) throw Error('1 argument is not an array');
      return strings.some(string => this.includes(string, index), this);
    
  6. contains(substr)
    String.prototype.contains = function(substr)
      return this.indexOf(substr) > -1;
    
  7. contains(substring)
    String.prototype.contains = function(substring) {
      return !!this.match(new RegExp(substring, 'i'));
    
  8. contains(substring)
    String.prototype.contains = function(substring) {
      return this.indexOf(substring) != -1;
    
  9. contains(substring, ignoreCase)
    String.prototype.contains = function(substring, ignoreCase) {
      var lowerSubString = substring.toLowerCase(),
      lowerThis = this.toLowerCase();
      if (ignoreCase) {
        return lowerThis.indexOf(lowerSubString) > -1;
      } else {
        return this.indexOf(substring) > -1;