# trim-repeated

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

Latest version **2.0.0** (published 2021-04-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install trim-repeated
pnpm add trim-repeated
yarn add trim-repeated
bun add trim-repeated
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2021-04-21 |
| First published | 2015-01-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=12 |
| Dependencies | 1 |
| Unpacked size | 2.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 21 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | condense, collapse, compact, consecutive, repeated, string, str, trim, remove, strip, character, char |

## Links

- npm: https://www.npmjs.com/package/trim-repeated
- Repository: https://github.com/sindresorhus/trim-repeated
- Homepage: https://github.com/sindresorhus/trim-repeated#readme
- Issues: https://github.com/sindresorhus/trim-repeated/issues
- npm.io page: https://npm.io/package/trim-repeated

## Dependencies (1)

- [escape-string-regexp](https://npm.io/package/escape-string-regexp.md) ^5.0.0

## Alternatives

- [d3-force-3d](https://npm.io/package/d3-force-3d.md) — 1.0M weekly downloads
- [ng2-charts](https://npm.io/package/ng2-charts.md) — 486.8K weekly downloads
- [@arcgis/core](https://npm.io/package/@arcgis/core.md) — 257.8K weekly downloads
- [react-sparklines](https://npm.io/package/react-sparklines.md) — 249.3K weekly downloads
- [react-native-gifted-charts](https://npm.io/package/react-native-gifted-charts.md) — 182.3K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2021-04-21
- 1.0.0 — 2015-01-13

## README

# trim-repeated

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

## Install

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

## Usage

```js
import trimRepeated from '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

---
_Source: https://npm.io/package/trim-repeated · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
