1.0.0 • Published 8 years ago

strip-falsy v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

strip-falsy

Build Status Coverage Status

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)