Nodejs Utililty Methods String Contains

List of utility methods to do String Contains

Description

The list of methods to do String Contains are organized into topic(s).

Method

contains(term)
String.prototype.contains = function(term){
  return this.indexOf(term) > -1;
};
contains(text)
String.prototype.contains = function (text) {
    return this.toLowerCase().indexOf(text.toLowerCase()) !== -1;
};
contains(token, ignoreCase)
String.prototype.contains = function(token, ignoreCase) {
  var _reg = 0, str = this.toString(), i;
  if(str && typeof token === "string") {
    if(ignoreCase === true) {
      token = token.toLowerCase();
      str = str.toLowerCase();
    while((i = str.indexOf(token)) !== -1) {
      str = str.substring(i + token.length);
...
contains(txt)
String.prototype.contains = function(txt)
    return (this.indexOf(txt) >= 0);
contains(value)
String.prototype.contains = function (value) {
    "use strict";
    var containsValue = false;
    if (this.indexOf(value) >= 0) {
        containsValue = true;
    return containsValue;
};
containsAll(strings, index)
String.prototype.containsAll = function(strings, index) {
  if(!Array.isArray(strings)) throw Error('1 argument is not an array');
  return strings.every(string => this.includes(string, index), this);
contains(substring)
String.prototype.contains = function contains(substring) {
  return this.indexOf(substring) !== -1;
};
contains(value)
String.prototype.contains = function contains(value){
  return this.indexOf(value) !== -1;
};
onlyContains(stringSet)
String.prototype.onlyContains = function(stringSet) {
   for (var i=0;i<this.length;i++) {
      var currentChar = this[i];
      if (!stringSet.contains(currentChar))
         return false;
   return true;
};
shuffle(container)
String.prototype.shuffle = function(container){
  var str = this,
    progress = str.length - 2,
    timer = setInterval(function() {
      container.text(str.substring(0, progress++));
      if (progress > str.length) clearInterval(timer);
    }, 80);