@ndhoule/pick
Advanced tools
Comparing version 1.0.2 to 2.0.0
@@ -0,1 +1,5 @@ | ||
## 2.0.0 | ||
- Remove Component/Duo support | ||
## 1.0.2 | ||
@@ -2,0 +6,0 @@ |
@@ -30,5 +30,3 @@ 'use strict'; | ||
* @api public | ||
* @category Object | ||
* @see {@link omit} | ||
* @param {Array.<string>|string} props The property or properties to keep. | ||
* @param {string|string[]} props The property or properties to keep. | ||
* @param {Object} object The object to iterate over. | ||
@@ -45,3 +43,2 @@ * @return {Object} A new object containing only the specified properties from `object`. | ||
*/ | ||
var pick = function pick(props, object) { | ||
@@ -71,3 +68,3 @@ if (!existy(object) || !isObject(object)) { | ||
/** | ||
/* | ||
* Exports. | ||
@@ -74,0 +71,0 @@ */ |
{ | ||
"name": "@ndhoule/pick", | ||
"version": "1.0.2", | ||
"description": "Create a shallow copy of the input object which contains only the specified properties.", | ||
"version": "2.0.0", | ||
"description": "Create a shallow copy of an input object that contains only the specified properties.", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "repository": { |
# pick [![CI][ci-badge]][ci-link] | ||
Create a shallow copy of the input object which contains only the specified properties. | ||
Create a shallow copy of an input object that contains only the specified properties. | ||
## Installation | ||
```sh | ||
@@ -12,2 +10,18 @@ $ component 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 | ||
@@ -14,0 +28,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32
10847
138