An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          

# in-array [![NPM version](https://img.shields.io/npm/v/in-array.svg?style=flat)](https://www.npmjs.com/package/in-array) [![NPM downloads](https://img.shields.io/npm/dm/in-array.svg?style=flat)](https://npmjs.org/package/in-array) [![Build Status](https://img.shields.io/travis/jonschlinkert/in-array.svg?style=flat)](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._