JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 78
  • Score
    100M100P100Q70080F

Clean objects recursively, deleting undefined & null or falsy properties

Package Exports

  • clean-obj

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (clean-obj) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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