Checks if array has a value.
npm install @extra-array/has-value.minChecks if array has a value.
:package:
:smiley_cat:
:running:
:vhs:
:moon:
:scroll:
:newspaper:
:blue_book:
> Similar: [value], [values], [hasValue], [searchValue].
> Similar: [hasValue], [hasPrefix], [hasInfix], [hasSuffix], [hasSubsequence], [hasPermutation], [hasPath].
> This is part of package [extra-array].
[extra-array]: https://www.npmjs.com/package/extra-array
> This is browserified, minified version of [@extra-array/has-value].
> It is exported as global variable array_hasValue.
> CDN: [unpkg], [jsDelivr].
[@extra-array/has-value]: https://www.npmjs.com/package/@extra-array/has-value
[unpkg]: https://unpkg.com/@extra-array/has-value.min
[jsDelivr]: https://cdn.jsdelivr.net/npm/@extra-array/has-value.min
``javascript`
array.hasValue(x, v, [fc], [fm]);
// x: an array
// v: value?
// fc: compare function (a, b)
// fm: map function (v, i, x)
`javascript
const array = require("extra-array");
var x = [1, 2, -3];
array.hasValue(x, 3);
// false
array.hasValue(x, 3, (a, b) => Math.abs(a) - Math.abs(b));
// true
array.hasValue(x, 3, null, v => Math.abs(v));
// true
``
- Array.prototype.includes: MDN web docs
- array-tools.contains: @75lb
[value]: https://github.com/nodef/extra-array/wiki/value
[values]: https://github.com/nodef/extra-array/wiki/values
[hasValue]: https://github.com/nodef/extra-array/wiki/hasValue
[searchValue]: https://github.com/nodef/extra-array/wiki/searchValue
[hasPrefix]: https://github.com/nodef/extra-array/wiki/hasPrefix
[hasInfix]: https://github.com/nodef/extra-array/wiki/hasInfix
[hasSuffix]: https://github.com/nodef/extra-array/wiki/hasSuffix
[hasSubsequence]: https://github.com/nodef/extra-array/wiki/hasSubsequence
[hasPermutation]: https://github.com/nodef/extra-array/wiki/hasPermutation
[hasPath]: https://github.com/nodef/extra-array/wiki/hasPath