does-include
v1.0.0
Published
find whether a string (or arr<string>) contains any, or all of another array of strings.
Downloads
43
Maintainers
Readme
does include
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'])