strip-falsy
v1.0.0
Published
Strip falsy properties from an object
Downloads
3
Readme
strip-falsy
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.
Install
$ npm install --save strip-falsy
Usage
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' }
Test
$ npm test
Author
Evan Lucas
License
MIT (See LICENSE
for more info)