# omit-empty

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

Latest version **1.0.0** (published 2018-12-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install omit-empty
pnpm add omit-empty
yarn add omit-empty
bun add omit-empty
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-12-10 |
| First published | 2014-09-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/omit-empty) |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 1 |
| Unpacked size | 10.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 73 |
| Author | Jon Schlinkert |
| Maintainers | jonschlinkert |
| Keywords | clear, delete, empty, find, has, hasown, javascript, js, key, keys, node, node-js, object, omit, properties, property, remove, util, utilities, utility, value |

## Links

- npm: https://www.npmjs.com/package/omit-empty
- Repository: https://github.com/jonschlinkert/omit-empty
- Issues: https://github.com/jonschlinkert/omit-empty/issues
- npm.io page: https://npm.io/package/omit-empty

## Dependencies (1)

- [kind-of](https://npm.io/package/kind-of.md) ^6.0.2

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.0 (latest) — 2018-12-10
- 0.4.1 — 2016-06-01
- 0.4.0 — 2016-06-01
- 0.3.6 — 2016-04-09
- 0.3.4 — 2016-03-27
- 0.3.3 — 2016-03-19
- 0.3.2 — 2015-12-25
- 0.3.1 — 2015-03-25
- 0.3.0 — 2014-10-06
- 0.2.0 — 2014-09-21
- 0.1.0 — 2014-09-21

## README

# omit-empty [![NPM version](https://img.shields.io/npm/v/omit-empty.svg?style=flat)](https://www.npmjs.com/package/omit-empty) [![NPM monthly downloads](https://img.shields.io/npm/dm/omit-empty.svg?style=flat)](https://npmjs.org/package/omit-empty) [![NPM total downloads](https://img.shields.io/npm/dt/omit-empty.svg?style=flat)](https://npmjs.org/package/omit-empty) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/omit-empty.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/omit-empty)

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

Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.

## Install

Install with [npm](https://www.npmjs.com/):

```sh
$ npm install --save omit-empty
```

## Heads up!

Breaking changes in v1.0.0! See the [Release History](#CHANGELOG.md).

## Usage

```js
const omitEmpty = require('omit-empty');

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

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

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

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

// set omitZero to true, to evaluate "0" as falsey
console.log(omitEmpty({ a: 0, b: 1 }, { omitZero: true }));
//=> { b: 1 }
```

## About

<details>
<summary><strong>Contributing</strong></summary>

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).

</details>

<details>
<summary><strong>Running Tests</strong></summary>

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

```sh
$ npm install && npm test
```

</details>

<details>
<summary><strong>Building docs</strong></summary>

_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_

To generate the readme, run the following command:

```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```

</details>

### Related projects

You might also be interested in these projects:

* [is-plain-object](https://www.npmjs.com/package/is-plain-object): Returns true if an object was created by the `Object` constructor. | [homepage](https://github.com/jonschlinkert/is-plain-object "Returns true if an object was created by the `Object` constructor.")
* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject "Returns true if the value is an object and not an array or null.")
* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of "Get the native type of a value.")

### Contributors

| **Commits** | **Contributor** |  
| --- | --- |  
| 31 | [jonschlinkert](https://github.com/jonschlinkert) |  
| 1  | [kakadiadarpan](https://github.com/kakadiadarpan) |  

### Author

**Jon Schlinkert**

* [GitHub Profile](https://github.com/jonschlinkert)
* [Twitter Profile](https://twitter.com/jonschlinkert)
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)

### License

Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).

***

_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on December 10, 2018._

---
_Source: https://npm.io/package/omit-empty · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
