@ndhoule/pick

Create a shallow copy of an input object that contains only the specified properties.

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 objectcontaining 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.

HomePage

https://github.com/ndhoule/pick

Repository

https://github.com/ndhoule/pick.git


上一篇:@segment/ad-params
下一篇:@ndhoule/map

相关推荐

官方社区

扫码加入 JavaScript 社区