# pick-util

> Return a copy of the object only containing the whitelisted properties.

Latest version **1.1.5** (published 2022-03-22) · MIT license · 0 weekly downloads

## Install

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

## 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.1.5 |
| Published | 2022-03-22 |
| First published | 2020-02-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 11.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jonathan Kemp |
| Maintainers | jonkemp |
| Keywords | object, pick, utility, util |

## Links

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

## Dependencies (1)

- [@jonkemp/package-utils](https://npm.io/package/@jonkemp/package-utils.md) ^1.0.8

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 1.1.5 (latest) — 2022-03-22
- 1.1.4 — 2022-01-16
- 1.1.3 — 2020-10-21
- 1.1.2 — 2020-03-31
- 1.1.1 — 2020-03-29
- 1.1.0 — 2020-03-21
- 1.0.2 — 2020-03-18
- 1.0.1 — 2020-02-20
- 1.0.0 — 2020-02-20
- 1.0.0-0 — 2020-02-19

## README

# pick-util ![Build Status](https://github.com/jonkemp/pick-util/actions/workflows/main.yml/badge.svg?branch=master)

> Return a copy of the object only containing the whitelisted properties. Alternatively accepts a predicate indicating which keys to pick.

Inspired by `_.pick`. 😄


## Install

Install with [npm](https://npmjs.org/package/pick-util)

```
$ npm install pick-util
```

Or [unpkg](https://unpkg.com/pick-util/)

```
<script src="https://unpkg.com/pick-util@1.1.2/umd/index.js" />
```

Check out the unit tests on [CodePen](https://codepen.io/jonkemp/full/OJVXabQ).

## Usage

```js
const pick = require('pick-util');

pick({ 'a': 1, 'b': '2', 'c': 3 }, ['a', 'c']);
//=> { 'a': 1, 'c': 3 }

pick({ name: 'moe', age: 50, userid: 'moe1' }, 'name', 'age');
//=> { name: 'moe', age: 50 }

const isNumber = obj => toString.call(obj) === '[object Number]';

pick({ name: 'moe', age: 50, userid: 'moe1' }, (value) => isNumber(value));
//=> { age: 50 }
```

---
| **Like us a lot?** Help others know why you like us! **Review this package on [pkgreview.dev](https://pkgreview.dev/npm/pick-util)** | ➡   | [![Review us on pkgreview.dev](https://i.ibb.co/McjVMfb/pkgreview-dev.jpg)](https://pkgreview.dev/npm/pick-util) |
| ----------------------------------------------------------------------------------------------------------------------------------------- | --- | --------------------------------------------------------------------------------------------------------------------- |

## API

### pick(object, *keys)

#### object

Type: `object`  
Default: `none`

The object to filter.

#### keys

Type: `array` or comma separated list of `string` values or `function`  
Default: `none`

Keys for the picked properties. Or a predicate indicating which keys to pick. 

## License

MIT

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