object-prune
Prune objects from non-values
Install
npm install --save object-prune
Usage
const prune =
prune(obj)
Walk an object recursively and remove
- keys with empty string values
- keys with object values without keys
- keys with array values without elements
// # {four: 4}
prune.emptyStrings(obj)
// # {two: [], three: {}, four: 4}
prune.emptyArrays(obj)
// # {one: "", three: {}, four: 4}
prune.emptyObjects(obj)
// # {one: "", two: [], four: 4}