nested-clean
v0.0.1
Published
Remove recursively all key-value pairs where value is undefined
Downloads
1
Maintainers
Readme
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' } }