Nodejs Utililty Methods Array Include

List of utility methods to do Array Include

Description

The list of methods to do Array Include are organized into topic(s).

Method

includes(item)
Array.prototype.includes = function(item) {
    return this.indexOf(item) > -1;
includes(matcher)
Array.prototype.includes = function(matcher) {
  var includes = false
    , arr = this;
  for( var j = 0, str; str = arr[j++]; ) {
    if( typeof str === "string" && str.includes(matcher) ) {
      includes = true;
  return includes;
...
includes(s)
Array.prototype.includes = function(s) {
    return this.indexOf(s) > -1;
};
includes(searchElement /*, fromIndex*/ )
Array.prototype.includes = Array.prototype.includes || (function(searchElement  ) {
  var O = Object(this);
  var len = parseInt(O.length, 10) || 0;
  if (len === 0) return false;
  var n = parseInt(arguments[1], 10) || 0;
  var k;
  if (n >= 0) {
    k = n;
  } else {
...
includes(searchElement /*, fromIndex*/ )
if (![].includes) {
  Array.prototype.includes = function(searchElement  ) {
    if (this === undefined || this === null) {
      throw new TypeError('Cannot convert this value to object');
    var O = Object(this);
    var len = parseInt(O.length, 10) || 0;
    if (len === 0) {
      return false;
...
includes(searchElement /*, fromIndex*/)
if (!Array.prototype.includes) {
  Array.prototype.includes = function(searchElement ) {
    'use strict';
    if (this == null) {
      throw new TypeError('Array.prototype.includes called on null or undefined');
    var O = Object(this);
    var len = parseInt(O.length, 10) || 0;
    if (len === 0) {
...
includes(searchElement)
Array.prototype.includes = function(searchElement) {  
    var O = Object(this);
    var len = parseInt(O.length) || 0;
    if (len === 0) {
      return false;
    var n = parseInt(arguments[1]) || 0;
    var k;
    if (n >= 0) {
...
includes(target)
Array.prototype.includes = function (target) {
  var result = false
  this.forEach(function (el) {
    if (el == target) {
      result = true
  });
  return result;
includes(target)
Array.prototype.includes = function(target) {
  for(var i in this) {
    if(this[i] === target) {
      return true;
    };
  };
  return false;
};
includes(val)
Array.prototype.includes = function (val) {
  var returnValue = false;
  this.forEach(function (el, i){
    if (val === el) {
      returnValue = true;
  });
  return returnValue;
};
...