Skip to content

Remove leading, trailing and repeated whitespace from a string

License

Notifications You must be signed in to change notification settings

sindresorhus/condense-whitespace

Repository files navigation

condense-whitespace

Remove leading, trailing, and repeated whitespace from a string

Install

$ npm install condense-whitespace

Usage

import condenseWhitespace from 'condense-whitespace';

condenseWhitespace('  foo bar     baz ');
//=> 'foo bar baz'

Related

  • trim-repeated - Trim a consecutively repeated substring: foo--bar---bazfoo-bar-baz