clean-object

1.0.2 • Public • Published

clean-object

Recursively delete properties from an object that have values of {}, or undefined

Usage

var cleanObject = require('clean-object');
 
var object = {
    a: 1,
    b: {
        c: {
            d: {
                e: {},
                f: undefined
            }
        },
        g: 2
    }
}
 
cleanObject(object);

will result in

 
{
    a: 1,
    b: {
        g: 2
    }
}

Package Sidebar

Install

npm i clean-object

Weekly Downloads

482

Version

1.0.2

License

MIT

Last publish

Collaborators

  • mauricebutler
  • mattlarner