clean-obj
v1.0.1
Published
Clean objects recursively, deleting undefined & null or falsy properties
Downloads
1,205
Maintainers
Readme
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