JSPM

does-include

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 12
  • Score
    100M100P100Q42160F

find whether a string (or arr<string>) contains any, or all of another array of strings.

Package Exports

  • does-include

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (does-include) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

does include

NPM version MIT License fliphub flipfam

find whether a string (or arr) contains any, or all of another array of strings.

📦 usage

yarn add does-include
npm i does-include --save
const does-include = require('does-include')

📘 examples

/**
 * @param  {Array<string> | string} haystack
 * @param  {Array<string>} needles
 * @param  {boolean} any
 * @return {boolean}
 */
const doesInclude = require('does-include')

// or can be destructured
const {any, all} = require('does-include')

any (default)

const doesInclude = require('does-include')

// can is in canada, so true.
doesInclude('canada', ['eh', 'can'])

all

const doesInclude = require('does-include')

// last argument is `any` (default true)
// 'canada' and 'can' are both in it, so true
doesInclude('canada', ['canada', 'can'])