js-object-pick
v3.0.0
Published
Returns a new object containing only the specified properties
Downloads
7
Maintainers
Readme
js-object-pick
Returns a new object only containing the specified properties
API
const pick = require('js-object-pick')
pick(jsObject, a string or an array of strings)
Usage
const pick = require('js-object-pick')
const package = require('./package.json')
const filter = pick(package, ['version', 'name'])
// filter should have only "version" & "name" props
const description = pick({desc: 'hey', value: 'Hello World'}, 'desc')
// description should be {desc: 'hey'}