https://github.com/jonschlinkert/in-array
Return true if a value exists in an array. Faster than using indexOf and won't blow up on null values.
https://github.com/jonschlinkert/in-array
array javascript nodejs
Last synced: 11 months ago
JSON representation
Return true if a value exists in an array. Faster than using indexOf and won't blow up on null values.
- Host: GitHub
- URL: https://github.com/jonschlinkert/in-array
- Owner: jonschlinkert
- License: mit
- Created: 2014-06-26T10:48:33.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2016-03-27T14:50:07.000Z (about 10 years ago)
- Last Synced: 2025-05-05T23:54:33.096Z (11 months ago)
- Topics: array, javascript, nodejs
- Language: JavaScript
- Homepage: https://github.com/jonschlinkert
- Size: 11.7 KB
- Stars: 16
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-micro-npm-packages - in-array - Return true if any of passed values exists in array - faster than using indexOf. (Modules / Array)
- awesome-micro-npm-packages-zh - in-array - 如果数组中存在任何传递值,则返回true - 快过 indexOf (模块 / 数组)
- fucking-awesome-micro-npm-packages - in-array - Return true if any of passed values exists in array - faster than using indexOf. (Modules / Array)
- awesome-micro-npm-packages - in-array - Return true if any of passed values exists in array - faster than using indexOf. (Modules / Array)
README
# in-array [](https://www.npmjs.com/package/in-array) [](https://npmjs.org/package/in-array) [](https://travis-ci.org/jonschlinkert/in-array)
> Return true if a value exists in an array. Faster than using indexOf and won't blow up on null values.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install in-array --save
```
## Usage
```js
var inArray = require('in-array');
console.log(inArray(['a', 'b', 'c'], 'a'));
//=> true
console.log(inArray(null, 'a'));
//=> false
console.log(inArray(null));
//=> false
```
## Related projects
You might also be interested in these projects:
* [arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten. | [homepage](https://github.com/jonschlinkert/arr-flatten)
* [arr-union](https://www.npmjs.com/package/arr-union): Combines a list of arrays, returning a single array with unique values, using strict equality… [more](https://www.npmjs.com/package/arr-union) | [homepage](https://github.com/jonschlinkert/arr-union)
* [is-plain-object](https://www.npmjs.com/package/is-plain-object): Returns true if an object was created by the `Object` constructor. | [homepage](https://github.com/jonschlinkert/is-plain-object)
* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject)
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/in-array/issues/new).
## Building docs
Generate readme and API documentation with [verb](https://github.com/verbose/verb):
```sh
$ npm install verb && npm run docs
```
Or, if [verb](https://github.com/verbose/verb) is installed globally:
```sh
$ verb
```
## Running tests
Install dev dependencies:
```sh
$ npm install -d && npm test
```
## Author
**Jon Schlinkert**
* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
## License
Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT license](https://github.com/jonschlinkert/in-array/blob/master/LICENSE).
***
_This file was generated by [verb](https://github.com/verbose/verb), v, on March 27, 2016._