Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ndhoule/pick
Create a shallow copy of an input object that contains only the specified properties.
https://github.com/ndhoule/pick
Last synced: 13 days ago
JSON representation
Create a shallow copy of an input object that contains only the specified properties.
- Host: GitHub
- URL: https://github.com/ndhoule/pick
- Owner: ndhoule
- License: mit
- Created: 2015-02-25T04:00:24.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-04-29T23:00:22.000Z (over 8 years ago)
- Last Synced: 2024-08-09T05:12:37.889Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- License: LICENSE.md
Awesome Lists containing this project
README
# pick [![CI][ci-badge]][ci-link]
Create a shallow copy of an input object that contains only the specified properties.
```sh
$ component install ndhoule/pick
$ npm install @ndhoule/pick
```## API
### `pick(props : string|string[], object: Object) => Object`
Return a shallow copy of an input `object` containing only a specified list of properties.
```javascript
var person = { name: 'Tim', occupation: 'enchanter', fears: 'rabbits' };pick('name', person);
//=> { name: 'Tim' }pick(['name', 'fears'], person);
//=> { name: 'Tim', fears: 'rabbits' }
```## License
Released under the [MIT license](LICENSE.md).
[ci-link]: https://travis-ci.org/ndhoule/pick
[ci-badge]: https://travis-ci.org/ndhoule/pick.svg?branch=master