Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonschlinkert/object.pick
(object pick) returns a filtered copy of an object with only the specified keys, exactly like `pick` from lo-dash / underscore.
https://github.com/jonschlinkert/object.pick
javascript nodejs object pick
Last synced: about 2 months ago
JSON representation
(object pick) returns a filtered copy of an object with only the specified keys, exactly like `pick` from lo-dash / underscore.
- Host: GitHub
- URL: https://github.com/jonschlinkert/object.pick
- Owner: jonschlinkert
- License: mit
- Created: 2014-09-22T06:36:01.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2021-09-10T03:08:44.000Z (about 3 years ago)
- Last Synced: 2024-05-01T22:15:21.668Z (5 months ago)
- Topics: javascript, nodejs, object, pick
- Language: JavaScript
- Homepage:
- Size: 17.6 KB
- Stars: 42
- Watchers: 5
- Forks: 13
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# object.pick [![NPM version](https://img.shields.io/npm/v/object.pick.svg?style=flat)](https://www.npmjs.com/package/object.pick) [![NPM monthly downloads](https://img.shields.io/npm/dm/object.pick.svg?style=flat)](https://npmjs.org/package/object.pick) [![NPM total downloads](https://img.shields.io/npm/dt/object.pick.svg?style=flat)](https://npmjs.org/package/object.pick) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/object.pick.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/object.pick)
> Returns a filtered copy of an object with only the specified keys, similar to `_.pick` from lodash / underscore.
You might also be interested in [object.omit](https://github.com/jonschlinkert/object.omit).
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save object.pick
```## benchmarks
This is the [fastest implementation](http://jsperf.com/pick-props) I tested. Pull requests welcome!
## Usage
```js
var pick = require('object.pick');pick({a: 'a', b: 'b'}, 'a')
//=> {a: 'a'}pick({a: 'a', b: 'b', c: 'c'}, ['a', 'b'])
//=> {a: 'a', b: 'b'}
```## About
### Related projects
* [extend-shallow](https://www.npmjs.com/package/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. | [homepage](https://github.com/jonschlinkert/extend-shallow "Extend an object with the properties of additional objects. node.js/javascript util.")
* [get-value](https://www.npmjs.com/package/get-value): Use property paths (`a.b.c`) to get a nested value from an object. | [homepage](https://github.com/jonschlinkert/get-value "Use property paths (`a.b.c`) to get a nested value from an object.")
* [mixin-deep](https://www.npmjs.com/package/mixin-deep): Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. | [homepage](https://github.com/jonschlinkert/mixin-deep "Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone.")
* [set-value](https://www.npmjs.com/package/set-value): Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths. | [homepage](https://github.com/jonschlinkert/set-value "Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths.")### Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
### Building docs
_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_
To generate the readme and API documentation with [verb](https://github.com/verbose/verb):
```sh
$ npm install -g verb verb-generate-readme && 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/object.pick/blob/master/LICENSE).***
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.2.0, on October 27, 2016._