UNPKG

@extra-array/is-value

Version:
49 lines (39 loc) 1.8 kB
Checks if array has a value. [:running:] [:vhs:] [:package:] [:moon:] [:ledger:] > Similar: [value], [values], [isValue], [searchValue].<br> > Similar: [isValue], [isPrefix], [isInfix], [isSuffix], [isSubsequence], [isPermutation].<br> > This is part of package [extra-array]. [extra-array]: https://www.npmjs.com/package/extra-array ```javascript array.isValue(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.isValue(x, 3); // false array.isValue(x, 3, (a, b) => Math.abs(a) - Math.abs(b)); // true array.isValue(x, 3, null, v => Math.abs(v)); // true ``` ### references - [Array.prototype.includes: MDN web docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes) - [array-tools.contains: @75lb](https://www.npmjs.com/package/array-tools) [:running:]: https://npm.runkit.com/@extra-array/is-value [:package:]: https://www.npmjs.com/package/@extra-array/is-value [:moon:]: https://www.npmjs.com/package/@extra-array/is-value.min [value]: https://github.com/nodef/extra-array/wiki/value [values]: https://github.com/nodef/extra-array/wiki/values [isValue]: https://github.com/nodef/extra-array/wiki/isValue [:ledger:]: https://unpkg.com/@extra-array/is-value/ [:vhs:]: https://asciinema.org/a/332085 [searchValue]: https://github.com/nodef/extra-array/wiki/searchValue [isPrefix]: https://github.com/nodef/extra-array/wiki/isPrefix [isInfix]: https://github.com/nodef/extra-array/wiki/isInfix [isSuffix]: https://github.com/nodef/extra-array/wiki/isSuffix [isSubsequence]: https://github.com/nodef/extra-array/wiki/isSubsequence [isPermutation]: https://github.com/nodef/extra-array/wiki/isPermutation