# pick-item

> Given an array, pick a random element and return it.

Latest version **1.0.4** (published 2016-04-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install pick-item
pnpm add pick-item
yarn add pick-item
bun add pick-item
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2016-04-25 |
| First published | 2016-04-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | bubkoo |
| Maintainers | bubkoo |
| Keywords | pick, sampling, item, array, array-like, generator, generate, random, randomly, randomize, chance, test, dice, mock |

## Links

- npm: https://www.npmjs.com/package/pick-item
- Repository: https://github.com/mock-end/pick-item
- Homepage: https://github.com/mock-end/pick-item#readme
- Issues: https://github.com/mock-end/pick-item/issues
- npm.io page: https://npm.io/package/pick-item

## Dependencies (2)

- [random-index](https://npm.io/package/random-index.md) ^1.0.4
- [is-array-like](https://npm.io/package/is-array-like.md) ^1.1.0

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2016-04-25
- 1.0.3 — 2016-04-24
- 1.0.2 — 2016-04-23
- 1.0.1 — 2016-04-15
- 1.0.0 — 2016-04-14
- 0.0.0 — 2016-04-12

## README

# pick-item

> Given an array, pick a random element and return it.

[![MIT License](https://img.shields.io/badge/license-MIT_License-green.svg?style=flat-square)](https://github.com/mock-end/pick-item/blob/master/LICENSE)

[![build:?](https://img.shields.io/travis/mock-end/pick-item/master.svg?style=flat-square)](https://travis-ci.org/mock-end/pick-item)
[![coverage:?](https://img.shields.io/coveralls/mock-end/pick-item/master.svg?style=flat-square)](https://coveralls.io/github/mock-end/pick-item)


## Install

```
$ npm install --save pick-item 
```

## Usage

> For more use-cases see the [tests](https://github.com/mock-end/pick-item/blob/master/test/spec/index.js)

```js
var pickItem = require('pick-item');

// API
// - pickItem(array);

pickItem([1, 2, 3]); // => 2
pickItem([1]);       // => 1
pickItem([]);        // => undefined
pickItem();          // => undefined
pickItem(null);      // => null
```

## Related

- [pick-items](https://github.com/mock-end/pick-items) - Given an array, pick some random elements and return them in a new array. 
- [pick-prop](https://github.com/mock-end/pick-prop) - Given an object, pick a random property and return it.
- [pick-props](https://github.com/mock-end/pick-props) - Given an object, pick some random properties and return them in an array.
- [pick-key](https://github.com/mock-end/pick-key) - Given an object, pick a random key and return it.
- [pick-keys](https://github.com/mock-end/pick-keys) - Given an object, pick some random keys and return them in an array.
- [pick-pair](https://github.com/mock-end/pick-pair) - Given an object, pick a random key-value and return it in a new object.
- [pick-pairs](https://github.com/mock-end/pick-pairs) - Given an object, pick some random key-values and return it in a new object.


## Contributing

Pull requests and stars are highly welcome.

For bugs and feature requests, please [create an issue](https://github.com/mock-end/pick-item/issues/new).

---
_Source: https://npm.io/package/pick-item · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
