Nodejs String Contains contains(substr)

Here you can find the source of contains(substr)

Method Source Code

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

Related

  1. contains(string, index)
    String.prototype.contains = function (string, index) {
      return this.indexOf(string, index) !== -1;
    };
    
  2. contains(string, index)
    String.prototype.contains = function (string, index) {
      return this.indexOf(string, index) !== -1;
    };
    
  3. 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;
    };
    
  4. 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);
    
  5. contains(subString)
    String.prototype.contains = function (subString) {
      return this.indexOf(subString) !== -1;
    };
    
  6. contains(substring)
    String.prototype.contains = function(substring) {
      return !!this.match(new RegExp(substring, 'i'));
    
  7. contains(substring)
    String.prototype.contains = function(substring) {
      return this.indexOf(substring) != -1;
    
  8. 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;
    
  9. contains(t)
    String.prototype.contains = function (t) {
        return this.indexOf(t) != -1;
    };