# extract-dom-content

> Get all of a DOM element's cleaned and standardized text content.

Latest version **1.1.0** (published 2020-11-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install extract-dom-content
pnpm add extract-dom-content
yarn add extract-dom-content
bun add extract-dom-content
```

## 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.1.0 |
| Published | 2020-11-08 |
| First published | 2020-11-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | emileperron |
| Keywords | text, dom, extract, content, readability, document |

## Links

- npm: https://www.npmjs.com/package/extract-dom-content
- Repository: https://github.com/koalatiapp/extract-dom-content
- Homepage: https://github.com/koalatiapp/extract-dom-content#readme
- Issues: https://github.com/koalatiapp/extract-dom-content/issues
- npm.io page: https://npm.io/package/extract-dom-content

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2020-11-08
- 1.0.0 — 2020-11-08

## README

# extract-dom-content

[![NPM version of extract-dom-content](https://img.shields.io/npm/v/extract-dom-content)](https://www.npmjs.com/package/extract-dom-content)

Provide a DOM element and get all of its cleaned and standardized text content in an array or string.

This library was originally developed with webpage spellchecking in mind, but can be used for any purpose you might have for it.

## Installation

```
npm install extract-dom-content
```

## API

<a name="extractDomContent"></a>

### extractDomContent(originalNode, [options]) ⇒ <code>String</code> \| <code>Array</code>
Takes in a DOM element and returns all of its text content.

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| originalNode | <code>Element</code> |  | DOM element to get the content from. |
| [options] | <code>Object</code> | <code>{}</code> | An object of options to apply additionals filters and/or change the return type. |
| [options.returnAsArray] | <code>boolean</code> | <code>false</code> | Whether the content should be returned as a linebreak-separated string or an array of strings. |
| [options.removeDuplicates] | <code>boolean</code> | <code>false</code> | Whether duplicate strings should be removed or kept. |

## Contributing

If you would like to add features, fix bugs or optimize this package, feel free to fork this repository and submit a pull request.

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