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: 10 months ago
JSON representation
Trims and replaces sequences of whitespace characters by a single space.
- Host: GitHub
- URL: https://github.com/xotic750/normalize-space-x
- Owner: Xotic750
- License: mit
- Created: 2017-03-16T18:07:33.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T23:27:32.000Z (about 3 years ago)
- Last Synced: 2025-04-30T20:27:19.575Z (10 months ago)
- Topics: browser, ecmascript, nodejs, normalizer, whitespace-character
- Language: JavaScript
- Homepage:
- Size: 2.22 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## 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
```