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

https://github.com/jonschlinkert/deep-pick

Like lo-dash/underscore `.pick()` but recursively merges and picks deeply nested occurences of a property.
https://github.com/jonschlinkert/deep-pick

javascript lodash object pick

Last synced: 2 months ago
JSON representation

Like lo-dash/underscore `.pick()` but recursively merges and picks deeply nested occurences of a property.

Awesome Lists containing this project

README

          

# deep-pick [![NPM version](https://badge.fury.io/js/deep-pick.svg)](http://badge.fury.io/js/deep-pick)

> Like lo-dash/underscore `.pick()` but recursively merges and picks deeply nested occurences of a property.

## Install
#### Install with [npm](npmjs.org)

```bash
npm i deep-pick --save
```

## Run tests

```bash
npm test
```

## Usage

```js
var deepPick = require('deep-pick');
var obj = {foo: {a: 'a'}, bar: {foo: {b: 'b'}}, baz: 'baz'};

deepPick(obj, 'foo');
//=> {foo: {a: 'a', b: 'b'}}
```

### options.value

Pass `value: true` to return **only the value** for the specified property:

```js
var obj = {foo: {a: 'a'}, bar: {foo: {b: 'b'}}, baz: 'baz'};

deepPick(obj, 'foo', {value: true});
//=> {a: 'a', b: 'b'}
```

## Author

**Jon Schlinkert**

+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

### Other javascript/node.js utils

Other projects that I maintain:

- [arrayify-compact](https://github.com/jonschlinkert/arrayify-compact)
- [compact-object](https://github.com/jonschlinkert/compact-object)
- [delete](https://github.com/jonschlinkert/delete)
- [for-in](https://github.com/jonschlinkert/for-in)
- [for-own](https://github.com/jonschlinkert/for-own)
- [has-any](https://github.com/jonschlinkert/has-any)
- [has-value](https://github.com/jonschlinkert/has-value)
- [is-number](https://github.com/jonschlinkert/is-number)
- [is-plain-object](https://github.com/jonschlinkert/is-plain-object)
- [mixin-deep](https://github.com/jonschlinkert/mixin-deep)
- [mixin-object](https://github.com/jonschlinkert/mixin-object)
- [object-length](https://github.com/jonschlinkert/object-length)
- [omit-empty](https://github.com/jonschlinkert/omit-empty)
- [reduce-object](https://github.com/jonschlinkert/reduce-object)

## License
Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license

***

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on September 22, 2014._