# empty-it

> Empties and optionally removes an element in the DOM-friendliest manner.

Latest version **1.0.0** (published 2016-12-22) · MIT license · 0 weekly downloads

## Install

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

## 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-12-22 |
| First published | 2016-12-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.3 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Tyler Peterson |
| Maintainers | tylerjpeterson |

## Links

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

## Recent versions

- 1.0.0 (latest) — 2016-12-22

## README

# empty-it
> Empties and optionally removes an element in the DOM-friendliest manner.


![100% test coverage](https://img.shields.io/badge/coverage-100%25-brightgreen.svg)

Removes all children from an element, optionally removing the element itself.
Any event listeners attached to the element or its children persist in memory, and therefore should be handled before calling to mitigate the risk of memory leaks.


## Installation
Install via npm:

```sh
$ npm i empty-it
```

## Usage
Exposed function requires its first parameter to be an element (the element to be emptied and possibly removed).
It accepts an optional second boolean parameter which determines if the element is to be removed after it is emptied.


```js
var emptyIt = require('empty-it');

// empty an element
emptyIt(document.getElementById('target1'));

// empty and delete element 
emptyIt(document.getElementById('target2'), true);

```

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