Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/xotic750/normalize-space-x

Trims and replaces sequences of whitespace characters by a single space.
https://github.com/xotic750/normalize-space-x

browser ecmascript nodejs normalizer whitespace-character

Last synced: about 1 month ago
JSON representation

Trims and replaces sequences of whitespace characters by a single space.

Awesome Lists containing this project

README

        


Travis status


Dependency status


devDependency status


npm version


jsDelivr hits


bettercodehub score


Coverage Status


Coverage Status

## normalize-space-x

Trims and replaces sequences of whitespace characters by a single space.

### `module.exports(string)` ⇒ string

### `normalize-space-x` ⇒ string

This method strips leading and trailing white-space from a string,
replaces sequences of whitespace characters by a single space,
and returns the resulting string. (ES2019)

**Kind**: static property of [normalize-space-x](#module_normalize-space-x)
**Returns**: string - The normalized string.
**Throws**:

- TypeError If string is null or undefined or not coercible.

| Param | Type | Description |
| ------ | ------------------- | ---------------------------- |
| string | string | The string to be normalized. |

**Example**

```js
import normalizeSpace from 'normalize-space-x';

console.log(normalizeSpace(' \t\na \t\nb \t\n') === 'a b'); // true
```