object-picker

0.2.0 • Public • Published

object-picker NPM version NPM downloads Build Status

Pick only what you want in an object.

Install

$ npm install --save object-picker

Usage

const picker = require('object-picker')
 
const obj = {
  foo: undefined,
  bar: '',
  baz: 'lol',
  zip: 'leave me alone'
}
 
picker(obj, ['foo', 'bar', 'barbee'])
//=> {foo: undefined, bar: ''}

API

objectPicker(obj, selections)

obj

Type: Object

The input object.

selections

Type: Array
Default: []

The fields to select.

License

MIT © EGOIST

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i object-picker

    Weekly Downloads

    20

    Version

    0.2.0

    License

    MIT

    Last publish

    Collaborators

    • kchan