clean-obj

1.0.1 • Public • Published

clean-obj

Clean objects recursively, deleting undefined & null or falsy properties.

Installation

  npm i clean-obj --save

Usage

cleanObj(obj [,strict])

The usage of this module is very straightforward, as you can see in the example below.

var cleanObj = require('clean-obj')
 
var obj = {
  key: 'value',
  undf: undefined,
  nullz: null,
  falsy: 0,
  bool: false
}
 
cleanObj(obj) // { set: 'value', falsy: 0, bool: false }
 
cleanObj(obj, true) // { set: 'value' }

License

MIT

/clean-obj/

    Package Sidebar

    Install

    npm i clean-obj

    Weekly Downloads

    89

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • ricardofbarros