@ndhoule/pick
v2.0.0
Published
Create a shallow copy of an input object that contains only the specified properties.
Downloads
386,045
Readme
pick
Create a shallow copy of an input object that contains only the specified properties.
$ 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.
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.