# @f/pick

> Return partial copy of object containing specified subset of keys.

Latest version **1.1.4** (published 2016-03-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install @f/pick
pnpm add @f/pick
yarn add @f/pick
bun add @f/pick
```

## 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.4 |
| Published | 2016-03-10 |
| First published | 2015-12-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | f |

## Links

- npm: https://www.npmjs.com/package/@f/pick
- Repository: https://github.com/micro-js/pick
- Homepage: https://github.com/micro-js/pick#readme
- Issues: https://github.com/micro-js/pick/issues
- npm.io page: https://npm.io/package/@f/pick

## Recent versions

- 1.1.4 (latest) — 2016-03-10
- 1.1.3 — 2016-03-10
- 1.1.2 — 2016-01-10
- 1.1.1 — 2015-12-16
- 1.1.0 — 2015-12-16

## README

# pick

[![Build status][travis-image]][travis-url]
[![Git tag][git-image]][git-url]
[![NPM version][npm-image]][npm-url]
[![Code style][standard-image]][standard-url]

Return partial copy of object containing specified subset of keys.

## Installation

    $ npm install @f/pick

## Usage

```js
var pick = require('@f/pick')

var source = {a: 1, b: 2, c: 3, d: function () {}}
var src1 = {a: 2}
var src2 = {a: 1, b: 2}

pick(['a', 'c'], source)     // => {a: 1, c: 3}
pick('a', source)            // => {a: 1}
pick(isFunction, source)     // => {d: function () {}}
pick(['a', 'b'], src1, src2) // => {a: 2, b: 2}
```

## API

### pick(keys, ...objs)

- `keys` - Key(s) to pick, or predicate function that receives `(val, key)`.
- `...objs` - Source objects to pick from, the object in the leftmost position has the highest priority. Multiple objects do not work with predicate functions.

**Returns:** partial copy of `obj`

## Progressive picking

This pick implementation has a somewhat unique feature - it can pick progressively from objects until the key is found. If you pass multiple objects it will, starting from the left hand side, use the first value in the list that is not undefined. E.g.

```javascript
var src1 = {a: 2}
var src2 = {a: 1, b: 2}

pick(['a', 'b'], src1, src2) // => {a: 2, b: 2}
```

## License

MIT

[travis-image]: https://img.shields.io/travis/micro-js/pick.svg?style=flat-square
[travis-url]: https://travis-ci.org/micro-js/pick
[git-image]: https://img.shields.io/github/tag/micro-js/pick.svg
[git-url]: https://github.com/micro-js/pick
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat
[standard-url]: https://github.com/feross/standard
[npm-image]: https://img.shields.io/npm/v/@f/pick.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@f/pick

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