Nodejs String Contains contains(obj)

Here you can find the source of contains(obj)

Method Source Code

String.prototype.contains = function (obj) {
    return this.indexOf(obj) >= 0;
};

Related

  1. contains(it) return this.indexOf(it) != -1; };
    String.prototype.contains = function(it) { return this.indexOf(it) != -1; };
    module.exports = {
        random: function(low,high){
          return Math.floor(Math.random() * (high - low + 1) + low);
        },
        randomArray: function(array){
          var randomIndex = this.random(0, array.length-1);
          return array[randomIndex];
        },
    ...
    
  2. contains(keyword)
    String.prototype.contains = function(keyword) {
        var stringContainsKeyword = this.indexOf(keyword) > -1;
        return stringContainsKeyword;
    
  3. contains(letra)
    String.prototype.contains = function(letra){
      return this.indexOf(letra)>-1
    
  4. contains(matcher)
    String.prototype.contains = function(matcher) {
      const regex = new RegExp(matcher, 'i')
      return regex.test(this)
    
  5. contains(needle)
    String.prototype.contains = function(needle) {
        return this.indexOf(needle) >= 0;
    };
    
  6. contains(pStr)
    String.prototype.contains = function(pStr) {
      return this.indexOf(pStr) > -1;
    };
    String.prototype.doUpperCase = function(pBeginIndex, pLength) {
      pLength = pLength || 1;
      return this.substring(pBeginIndex, pLength).toUpperCase() + this.substring(pBeginIndex + pLength);
    };
    String.prototype.doLowerCase = function(pBeginIndex, pLength) {
      pLength = pLength || 1;
    ...
    
  7. contains(palavra)
    String.prototype.contains = function (palavra) {
      let indice = this.trim().indexOf(palavra);
      return indice >= 0;
    
  8. contains(pattern)
    String.prototype.contains = function(pattern) {
      return this.indexOf(pattern) !== -1;
    };
    
  9. contains(pattern)
    String.prototype.contains = function(pattern) {
        return this.indexOf(pattern.canonize())>=0;
    };