1.0.1 • Published 5 years ago

pick.js v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

pick.js

Utility function to create a shallow copy of an object which is composed of the picked object properties.

Usage

npm install pick.js --save
import pick from 'pick.js'
var campcc = { name: 'capmcc', age: 18, career: 'engineer' }
pick(capmcc, 'age') // { age: 18 }
pick(campcc, ['age', 'enginner']) // { age: 18, career: 'engineer' }

API

pick(obj: object, properties: string | string[]) : object

return a shallow copy which is composed of the picked object properties.

LICENSE

MIT