# condense-whitespace

> Remove leading, trailing, and repeated whitespace from a string

Latest version **3.0.0** (published 2021-08-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install condense-whitespace
pnpm add condense-whitespace
yarn add condense-whitespace
bun add condense-whitespace
```

## Health

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

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2021-08-10 |
| First published | 2015-01-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/condense-whitespace) |
| Module format | ESM |
| Node | ^12.20.0 \|\| ^14.13.1 \|\| >=16.0.0 |
| Dependencies | 0 |
| Unpacked size | 2.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 42 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | whitespace, space, condense, collapse, compact, repeated, string, trim, remove, strip |

## Links

- npm: https://www.npmjs.com/package/condense-whitespace
- Repository: https://github.com/sindresorhus/condense-whitespace
- Homepage: https://github.com/sindresorhus/condense-whitespace#readme
- Issues: https://github.com/sindresorhus/condense-whitespace/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/condense-whitespace

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 3.0.0 (latest) — 2021-08-10
- 2.0.0 — 2019-04-09
- 1.0.0 — 2015-01-13

## README

# condense-whitespace

> Remove leading, trailing, and repeated whitespace from a string

## Install

```
$ npm install condense-whitespace
```

## Usage

```js
import condenseWhitespace from 'condense-whitespace';

condenseWhitespace('  foo bar     baz ');
//=> 'foo bar baz'
```

## Related

- [`trim-repeated`](https://github.com/sindresorhus/trim-repeated) - Trim a consecutively repeated substring: `foo--bar---baz` → `foo-bar-baz`

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