Package Exports
- arr-includes
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 (arr-includes) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
arr-includes

Return positive value if any of passed values exists in array.
Install
npm i arr-includes --save
Usage
For more use-cases see the tests
const arrIncludes = require('arr-includes')
arrIncludes
Check any of
values
exists onarr
.
Example
var arrIncludes = require('arr-includes')
console.log(arrIncludes([1, 'bar', 55], 2)) // => false
console.log(arrIncludes([1, 'bar', 3], 3)) // => 2
console.log(arrIncludes([1, 'bar', 3, true], false)) // => false
console.log(arrIncludes([1, 'bar', 44, true], true)) // => 3
console.log(arrIncludes(['foo', 'bar'], 'baz')) // => false
console.log(arrIncludes(['foo', 'bar'], 'foo')) // => true
console.log(arrIncludes(['qux', 'foo', 'bar'], 'foo')) // => 1
console.log(arrIncludes([true, 'qqq', 'bar'], true)) // => true
console.log(arrIncludes(['true', 'qqq', 'bar'], true)) // => false
console.log(arrIncludes(['qqq', 'bar', true], true)) // => 2
console.log(arrIncludes(['qqq', 'true', 'bar'], true)) // => false
console.log(arrIncludes([false, 'foo', null, 'bar'], null)) // => 2
console.log(arrIncludes(['foo', 'bar', 'qux'], ['a', 'b', 'c'])) // => false
console.log(arrIncludes(['b', 'a', 'c'], ['a', 'b', 'c'])) // => 1
console.log(arrIncludes(['foo', 'bb', 'b'], ['a', 'b'])) // => 2
console.log(arrIncludes(['foo', 'bar', 'qux'], ['a', 'b', 'foo'])) // => true
console.log(arrIncludes(['bar', 123, 'foo', 'qux'], ['a', 'b', 'foo'])) // => 2
Params
arr
{Array}: array to checkvalues
{Array|String}: array or stringreturns
{Boolean|Number}: returnsfalse
if not found,true
if index is 0 from the array, otherwisenumber
index
Related
- in-array: Return true if a value exists in an array. Faster than using… more | homepage
- is-async-function: Is function really asynchronous function? Trying to guess that based on check… more | homepage
- is-installed: Checks that given package is installed on the system - globally or… more | homepage
- is-missing: Check that given
name
oruser/repo
exists in npm registry or in… more | homepage - isarray: Array#isArray for older browsers | homepage
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.