aboutsummaryrefslogtreecommitdiff
path: root/node_modules/trim-repeated/readme.md
blob: 7f5a7a70adcb7c22d11992de47df1e75a8b66324 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# trim-repeated [![Build Status](https://travis-ci.org/sindresorhus/trim-repeated.svg?branch=master)](https://travis-ci.org/sindresorhus/trim-repeated)

> Trim a consecutively repeated substring: `foo--bar---baz` → `foo-bar-baz`


## Install

```
$ npm install --save trim-repeated
```


## Usage

```js
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`](https://github.com/sindresorhus/condense-whitespace) - Remove leading, trailing and repeated whitespace from a string


## License

MIT © [Sindre Sorhus](http://sindresorhus.com)