# clean-deep

> Remove falsy, empty or nullable values from objects

Latest version **3.4.0** (published 2020-08-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install clean-deep
pnpm add clean-deep
yarn add clean-deep
bun add clean-deep
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.4.0 |
| Published | 2020-08-19 |
| First published | 2015-11-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 3 |
| Unpacked size | 15.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 152 |
| Author | Nuno Sousa |
| Maintainers | fixe, nunofgs, ruimarinho |
| Keywords | clean, clean-deep, deep |

## Links

- npm: https://www.npmjs.com/package/clean-deep
- Repository: https://github.com/nunofgs/clean-deep
- Issues: https://github.com/nunofgs/clean-deep/issues
- npm.io page: https://npm.io/package/clean-deep

## Dependencies (3)

- [lodash.isempty](https://npm.io/package/lodash.isempty.md) ^4.4.0
- [lodash.transform](https://npm.io/package/lodash.transform.md) ^4.6.0
- [lodash.isplainobject](https://npm.io/package/lodash.isplainobject.md) ^4.0.6

## Recent versions

- 3.4.0 (latest) — 2020-08-19
- 3.3.0 — 2020-02-11
- 3.2.0 — 2019-12-04
- 3.1.0 — 2019-10-15
- 3.0.5 — 2019-09-10
- 3.0.4 — 2019-08-27
- 3.0.3 — 2019-08-27
- 3.0.2 — 2017-08-29
- 3.0.1 — 2017-07-18
- 3.0.0 — 2017-04-26
- 2.0.2 — 2017-03-09
- 2.0.1 — 2016-11-02
- 2.0.0 — 2016-10-05
- 1.0.0 — 2016-09-09
- 0.0.1 — 2015-11-13

## README

# clean-deep

Removes empty _objects_, _arrays_, empty _strings_, _NaN_, _null_ and _undefined_ values from objects. Does not alter the original object.

As of version 3.0.0, _clean-deep_ traverses arrays as well as objects.

## Status

[![npm version][npm-image]][npm-url] [![build status][workflow-image]][workflow-url]

## Installation

Install the package via `npm`:

```
$ npm install clean-deep --save
```

## Usage

### Arguments

1. `object` _(Object)_: The source object.
2. `[options]` _(Object)_: An optional object with the following options:

Option            | Default value | Description
----------------- | ------------- | -----------------------------------
_cleanKeys_       | _[]_          | Remove specific keys, ie: `['foo', 'bar', ' ']`
_cleanValues_     | _[]_          | Remove specific values, ie: `['foo', 'bar', ' ']`
_emptyArrays_     | _true_        | Remove empty arrays, ie: `[]`
_emptyObjects_    | _true_        | Remove empty objects, ie: `{}`
_emptyStrings_    | _true_        | Remove empty strings, ie: `''`
_NaNValues_       | _false_       | Remove NaN values, ie: `NaN`
_nullValues_      | _true_        | Remove null values, ie: `null`
_undefinedValues_ | _true_        | Remove undefined values, ie: `undefined`

_(Object)_: Returns the cleansed object.

### Example

```javascript
const cleanDeep = require('clean-deep');
const object = {
  bar: {},
  baz: null,
  biz: 'baz',
  foo: '',
  net: [],
  nit: undefined,
  qux: {
    baz: 'boz',
    txi: ''
  }
};

cleanDeep(object);
// => { biz: 'baz', qux: { baz: 'boz' } }
```

## Tests

```javascript
$ npm test
```

## Release

```sh
npm version [<newversion> | major | minor | patch] -m "Release %s"
```

## License

MIT

[npm-image]: https://img.shields.io/npm/v/clean-deep.svg?style=flat-square
[npm-url]: https://npmjs.org/package/clean-deep
[workflow-image]: https://github.com/nunofgs/clean-deep/workflows/Node%20CI/badge.svg
[workflow-url]: https://github.com/nunofgs/clean-deep/actions

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