How to use array-includes - 10 common examples

To help you get started, we’ve selected a few array-includes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github boltpkg / bolt / src / utils / symlinkPackageDependencies.js View on Github external
******************************************************************/

  // TODO: Same as above, we should really be making sure we get all the transitive bins as well

  for (let dependency of internalDeps) {
    let depWorkspace = dependencyGraph.get(dependency) || {};
    let depBinFiles =
      depWorkspace.pkg &&
      depWorkspace.pkg.config &&
      depWorkspace.pkg.config.getBin();

    if (!depBinFiles) {
      continue;
    }

    if (!includes(dependencies, dependency)) {
      // dependency is not one we are supposed to symlink right now
      continue;
    }

    if (typeof depBinFiles === 'string') {
      // package may be scoped, name will only be the second part
      let binName = dependency.split('/').pop();
      let src = path.join(depWorkspace.pkg.dir, depBinFiles);
      let dest = path.join(pkg.nodeModulesBin, binName);

      symlinksToCreate.push({ src, dest, type: 'exec' });
      continue;
    }

    for (let [binName, binPath] of Object.entries(depBinFiles)) {
      let src = path.join(depWorkspace.pkg.dir, String(binPath));
github JPeer264 / node-rcs-core / lib / baseLibrary.js View on Github external
isExcluded(string) {
    if (string === '__proto__') {
      // Since this.values['__proto__'] always exists, we mustn't accept this as a renaming
      return true;
    }
    if (includes(this.excludes, string)) {
      return true;
    }

    return (
      this.excludesRegex.some((excludeRegex) => (
        string.match(excludeRegex)
      ))
    );
  }
}
github sharetribe / ftw-daily / src / util / polyfills.js View on Github external
//
// Use common polyfill dependencies from package.json
//

// Smoothscroll
require('smoothscroll-polyfill').polyfill();

// [].includes
require('array-includes').shim();

// [].find
require('array.prototype.find').shim();

// Object.entries
require('object.entries').shim();

// Object.values
require('object.values').shim();

// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/parseFloat
if (typeof Number.parseFloat === 'undefined' && typeof window !== 'undefined') {
  Number.parseFloat = window.parseFloat;
}

// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/parseInt
github ibuildingsnl / owasp-aasvs / bin / convert-to-readthedocs / src / convert.js View on Github external
// This node program relies on the --harmony flag (ES6 functionality)
// Run with "node --harmony convert.js"
///////////////

const DOC_DIR = __dirname + '/../../../docs/';

let asvs = require('owasp-asvs'),
    fs = require('fs'),
    pdc = require('pdc'),
    aasvs = require('./../../../src/aasvs.json'),
    includes = require('array-includes'),
    lang = 'en';

/* when Array#includes is not present */
delete Array.prototype.includes;
var shimmedIncludes = includes.shim();

asvs.requirements.forEach(function(requirement) {
    let annotatedRequirement = aasvs.requirements.find(
        (annotatedRequirement) =>
            (annotatedRequirement.chapterNr === requirement.chapterNr &&
             annotatedRequirement.nr        === requirement.nr)
    );

    if (!annotatedRequirement) {
        return;
    }

    let title = requirement.chapterNr + '.' + requirement.nr + ' ' + annotatedRequirement.shortTitle[lang];

    let requirementDoc = `${title}
${"=".repeat(title.length)}
github ytham / robotarm / node_modules / johnny-five / lib / johnny-five.js View on Github external
require("es6-shim");
require("array-includes").shim();


module.exports = {
  // extract-start:apinames
  Accelerometer: require("./accelerometer"),
  Animation: require("./animation"),
  Barometer: require("./barometer"),
  Board: require("./board"),
  Button: require("./button"),
  Color: require("./color"),
  Compass: require("./compass"),
  Distance: require("./distance"),
  ESC: require("./esc"),
  Expander: require("./expander"),
  Fn: require("./fn"),
  Gripper: require("./gripper"),
github ytham / robotarm / node_modules / johnny-five / lib / board.js View on Github external
require("es6-shim");
require("array-includes").shim();

var IS_TEST_MODE = !!process.env.IS_TEST_MODE;
var Emitter = require("events").EventEmitter;
var util = require("util");
// var os = require("os");
var chalk = require("chalk");
var _ = require("lodash");
var Collection = require("../lib/mixins/collection");
var __ = require("../lib/fn.js");
var Repl = require("../lib/repl.js");
var Options = require("../lib/board.options.js");
var Pins = require("../lib/board.pins.js");
//var temporal = require("temporal");
//var IO;

// Environment Setup
github carloscuesta / generator-starterkit / generators / app / index.es6.js View on Github external
function hasAdditionalPackages(pkg) {
			return answers.additionalPackages && includes(answers.additionalPackages, pkg);
		}
		this.appname = answers.name;

array-includes

An ES7/ES2016 spec-compliant `Array.prototype.includes` shim/polyfill/replacement that works as far down as ES3.

MIT
Latest version published 8 months ago

Package Health Score

73 / 100
Full package analysis

Popular array-includes functions