Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

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

Install

npm i clean-obj

DownloadsWeekly Downloads

104

Version

1.0.1

License

MIT

Last publish

Collaborators

  • avatar