JSPM

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

Recursively omit empty properties from an object. Omits empty objects, arrays, strings or zero.

Package Exports

  • omit-empty

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 (omit-empty) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

omit-empty NPM version

Recursively omit empty properties from an object. Omits empty objects, arrays, strings or zero.

Install

Install with npm

npm i omit-empty --save

Run tests

npm test

Usage

var omitEmpty = require('omit-empty');

omitEmpty({a: 'a', b: ''});
//=> {a: 'a'}

omitEmpty({a: 'a', b: {c: 'c', d: ''});
//=> {a: 'a', b: {c: 'c'}

omitEmpty({a: ['a'], b: []});
//=> {a: ['a']}

omitEmpty({a: 0, b: 1});
//=> {a: 0, b: 1}

// set the `noZero` flag
omitEmpty({a: 0, b: 1}, true);
//=> {b: 1}

Author

Jon Schlinkert

License

Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license


This file was generated by verb-cli on September 21, 2014.