Remove leading, trailing, and repeated whitespace from a string
$ npm install condense-whitespace
import condenseWhitespace from 'condense-whitespace';
condenseWhitespace(' foo bar baz ');
//=> 'foo bar baz'
trim-repeated
- Trim a consecutively repeated substring:foo--bar---baz
→foo-bar-baz