nested-clean

0.0.1 • Public • Published

Nested Clean

Remove recursively all value / key-value pairs where the value is undefined.

Installation

npm install --save nested-clean

Usage

const clean = require('nested-clean');

const nestedObject = {
    a: undefined,
    b: {
        prop1: null,
        prop2: [1, undefined, "a"],
        prop3: "b1"
    },
    c: {
        d: {
            e: {
                f: undefined
            }
        }
    }
}

const cleanedNestedObject = clean(nestedObject);

console.log(cleanedNestedObject);
// { b: { prop1: null, prop2: [ 1, 'a' ], prop3: 'b1' } }

Package Sidebar

Install

npm i nested-clean

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

2.06 kB

Total Files

3

Last publish

Collaborators

  • didiercl