trim-repeated ![Build Status](https://camo.githubusercontent.com/bea8293e3c041d19a2a974b74cf7094cf04b900d41293ad89b22cce97cd7273f/68747470733a2f2f7472617669732d63692e6f72672f73696e647265736f726875732f7472696d2d72657065617465642e7376673f6272616e63683d6d6173746572)
Trim a consecutively repeated substring:
foo--bar---baz
→foo-bar-baz
Install
$ npm install --save trim-repeated
Usage
var trimRepeated = require('trim-repeated');
trimRepeated('foo--bar---baz', '-');
//=> 'foo-bar-baz'
trimRepeated('foo@#@#baz', '@#');
//=> 'foo@#baz'
trimRepeated(input, target)
input
Required
Type: string
target
Required
Type: string
Substring to trim.
Related
condense-whitespace
- Remove leading, trailing and repeated whitespace from a string
License
MIT © Sindre Sorhus