Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/xotic750/normalize-space-x
- Owner: Xotic750
- License: mit
- Created: 2017-03-16T18:07:33.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T23:27:32.000Z (almost 2 years ago)
- Last Synced: 2024-11-10T17:03:15.540Z (about 1 month ago)
- Topics: browser, ecmascript, nodejs, normalizer, whitespace-character
- Language: JavaScript
- Homepage:
- Size: 2.22 MB
- Stars: 0
- Watchers: 2
- 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
```