# empty-trim

> Remove empty subobjects from your objects({})

Latest version **1.0.0** (published 2016-06-24) · ISC license · 0 weekly downloads

## Install

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

## 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 | 1.0.0 |
| Published | 2016-06-24 |
| First published | 2016-06-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Ayush Gupta |
| Maintainers | ayushgp |
| Keywords | trim, object, empty, remove, delete |

## Links

- npm: https://www.npmjs.com/package/empty-trim
- Repository: https://github.com/ayushgp/empty-trim
- Homepage: https://github.com/ayushgp/empty-trim#readme
- Issues: https://github.com/ayushgp/empty-trim/issues
- npm.io page: https://npm.io/package/empty-trim

## Recent versions

- 1.0.0 (latest) — 2016-06-24

## README

# empty-trim
A module to remove empty subobjects from given object recursively.

## Installation
With npm
```bash
npm install empty-trim
```

## Example

```js
var trim = require('trim-empty');
var obj = {
  level1:{
    level2:{
      level3:{
        name: "Foo"
      },
      emptyOne: {
        inner: {}
      }
    },
    anotherLevel2: "bar"
  }
};

trim(obj); 
/*
Object now:
obj => {
  level1:{
    level2:{
      level3:{
        name: "Foo"
      }
    },
    anotherLevel2: "bar"
  }
}
*/
```

## API

### trim(object);

Removes all empty objects({}) recursively. **If object becomes empty after its children are removed, it'll remove empty parent too.**

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