normalize-space-x
Trims and replaces sequences of whitespace characters by a single space.
normalize-space-x.normalizeSpace2016
⇒ 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. (ES2016)
Kind: static property of 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
import {normalizeSpace2016} from 'normalize-space-x';
console.log(normalizeSpace2016(' \t\na \t\nb \t\n') === 'a b');
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. (ES2018)
Kind: static property of 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
import normalizeSpace from 'normalize-space-x';
console.log(normalizeSpace(' \t\na \t\nb \t\n') === 'a b');