does-include

1.0.0 • Public • Published

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'])

Package Sidebar

Install

npm i does-include

Weekly Downloads

8

Version

1.0.0

License

none

Last publish

Collaborators

  • aretecode