clean-obj
Clean objects recursively, deleting undefined & null or falsy properties
Last updated 4 years ago by ricardofbarros .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install clean-obj 
SYNC missed versions from official npm registry.

clean-obj

Clean objects recursively, deleting undefined & null or falsy properties.

Installation

  npm i clean-obj --save

Usage

cleanObj(obj [,strict])

The usage of this module is very straightforward, as you can see in the example below.

var cleanObj = require('clean-obj')

var obj = {
  key: 'value',
  undf: undefined,
  nullz: null,
  falsy: 0,
  bool: false
}

cleanObj(obj) // { set: 'value', falsy: 0, bool: false }

cleanObj(obj, true) // { set: 'value' }

License

MIT

Current Tags

  • 1.0.1                                ...           latest (4 years ago)

5 Versions

  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
  • 0.1.2                                ...           6 years ago
  • 0.1.1                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (6)

Copyright 2014 - 2016 © taobao.org |