31 lines
658 B
Markdown
31 lines
658 B
Markdown
# condense-whitespace [![Build Status](https://travis-ci.org/sindresorhus/condense-whitespace.svg?branch=master)](https://travis-ci.org/sindresorhus/condense-whitespace)
|
|
|
|
> Remove leading, trailing, and repeated whitespace from a string
|
|
|
|
|
|
## Install
|
|
|
|
```
|
|
$ npm install condense-whitespace
|
|
```
|
|
|
|
|
|
## Usage
|
|
|
|
```js
|
|
const condenseWhitespace = require('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`
|
|
|
|
|
|
## License
|
|
|
|
MIT © [Sindre Sorhus](https://sindresorhus.com)
|