Skip to content

helpdotcom/strip-falsy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

Strip falsy values from an object

Resources

License

Stars

Watchers

Forks

Packages

No packages published