collapseWhitespace

Replaces consecutive whitespace characters with a single space.

Install

Install all functions of strman

yarn add strman

or just the collapseWhitespace function

yarn add strman.collapsewhitespace

Usage

import { collapseWhitespace } from 'strman'
// OR
import collapseWhitespace from 'strman.collapsewhitespace'
Parameters:
Name Type Description
value String

The input string

Source:
Returns:

The whitespace collapsed string

Type
String
Example
collapseWhitespace('  a  b  c  ')
// => 'a b c'