js-object-pick

3.0.0 • Public • Published

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)

/js-object-pick/

    Package Sidebar

    Install

    npm i js-object-pick

    Weekly Downloads

    5

    Version

    3.0.0

    License

    ISC

    Last publish

    Collaborators

    • quim