normalize-space-x

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

MIT 42 个版本
安装
npm install normalize-space-x
yarn add normalize-space-x
pnpm add normalize-space-x
bun add normalize-space-x
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-xstring

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
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'); // true
版本列表
4.1.2 2019-08-28
4.1.1 2019-08-20
4.1.0 2019-08-14
4.0.38 2019-07-31
4.0.37 2019-07-27
4.0.36 2019-07-27
4.0.35 2019-07-26
4.0.34 2019-07-25
4.0.33 2019-07-24
4.0.32 2019-07-24
4.0.31 2019-07-23
4.0.29 2019-07-22
4.0.28 2019-07-21
4.0.27 2019-07-19
4.0.26 2019-07-18
4.0.25 2019-07-18
4.0.24 2019-07-17
4.0.23 2019-07-17
4.0.22 2019-07-17
4.0.21 2019-07-17
4.0.20 2019-07-16
4.0.19 2019-07-16
4.0.18 2019-07-16
4.0.17 2019-07-15
4.0.16 2019-07-15
4.0.15 2019-07-14
4.0.14 2019-07-13
4.0.13 2019-07-13
4.0.12 2019-07-12
4.0.1 2019-07-11
4.0.0 2019-07-10
3.0.0 2017-10-16
2.0.0 2017-09-26
1.3.4 2017-09-26
1.3.3 2017-09-01
1.3.2 2017-08-10
1.3.1 2017-08-10
1.3.0 2017-07-12
1.2.0 2017-03-29
1.1.1 2017-03-29
1.1.0 2017-03-29
1.0.0 2017-03-16