3.0.0 • Published 7 years ago

js-object-pick v3.0.0

Weekly downloads
10
License
ISC
Repository
github
Last release
7 years ago

js-object-pick

Returns a new object only containing the specified properties

Build StatusCode Coverage 100%ISC LicenseNodeJS

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'}

ISC License (ISC)