pruning-shears

1.0.0 • Public • Published

remove properties on objects

usecase:

get rid of database fields you might not want a user to be aware of without having to hard code all of the properties to delete

usage:

  const pruner = require('../lib/core')();

  let obj = {
    field1: 'hello world',
    field2: 'foo',
    field3: 'bar' 
  }

  console.log(pruner.remove(obj, ['field1']));
  console.log(pruner.keep(obj, ['field1']));

  // returns 
  // { field2: 'foo', field3: 'bar' }
  // { field1: 'hello world' }

Readme

Keywords

none

Package Sidebar

Install

npm i pruning-shears

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

3.28 kB

Total Files

7

Last publish

Collaborators

  • immexerxez