https://github.com/luftywiranda13/is-array-elem
Check if value is found in array
https://github.com/luftywiranda13/is-array-elem
Last synced: 30 days ago
JSON representation
Check if value is found in array
- Host: GitHub
- URL: https://github.com/luftywiranda13/is-array-elem
- Owner: luftywiranda13
- License: mit
- Created: 2017-08-21T13:53:34.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-01-16T12:56:25.000Z (over 8 years ago)
- Last Synced: 2025-02-26T08:46:52.978Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 13.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# is-array-elem
[](https://www.npmjs.com/package/is-array-elem)
[](https://travis-ci.org/luftywiranda13/is-array-elem)
[](https://npm-stat.com/charts.html?package=is-array-elem&from=2016-04-01)
Check if value is found in array, using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
## Installation
```sh
npm install --save is-array-elem
```
## Usage
```js
const isArrayElem = require('is-array-elem');
isArrayElem(['foo', 'bar'], 'bar');
//=> true
isArrayElem(['foo', 'bar'], 'baz');
//=> false
isArrayElem(['foo', 'bar'], 'foo');
//=> true
```
## API
### isArrayElem(array, value)
#### Parameters
| Name | Type | Description |
| ---- | ---- | ----------- |
| array | `Array` | Array to inspect |
| value | `*` | Value to search for |
#### Returns
- `Boolean`
## Related
- [lodash.indexof](https://www.npmjs.com/package/lodash.indexof) - Gets the index of value in array
## License
MIT © [Lufty Wiranda](https://www.instagram.com/luftywiranda13)