Strip falsy properties from an object.
Note: The package actually creates a new object that has all of the non-falsy properties of the input instead of deleting the properties. This is done for performance reasons.
$ npm install --save strip-falsy
var strip = require('strip-falsy')
var input = {
a: false
, b: 0
, c: null
, d: undefined
, e: ''
, f: 'biscuits'
, g: '0'
}
var out = strip(input)
// => { f: 'biscuits', g: '0' }
$ npm test
Evan Lucas
MIT (See LICENSE
for more info)