0.0.4 • Published 9 years ago
object-prune v0.0.4
object-prune
Prune objects from non-values
Install
npm install --save object-pruneUsage
const prune = require('object-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
prune({one: "", two: [], three: {}, four: 4}) // # {four: 4}prune.emptyStrings(obj)
prune({one: "", two: [], three: {}, four: 4}) // # {two: [], three: {}, four: 4}prune.emptyArrays(obj)
prune({one: "", two: [], three: {}, four: 4}) // # {one: "", three: {}, four: 4}prune.emptyObjects(obj)
prune({one: "", two: [], three: {}, four: 4}) // # {one: "", two: [], four: 4}