trim-repeated
Trim a consecutively repeated substring: foo--bar---baz → foo-bar-baz
Last updated 4 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install trim-repeated 
SYNC missed versions from official npm registry.

trim-repeated

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

Install

$ npm install trim-repeated

Usage

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

Current Tags

  • 2.0.0                                ...           latest (4 years ago)

2 Versions

  • 2.0.0                                ...           4 years ago
  • 1.0.0                                ...           10 years ago
Downloads
Today 0
This Week 0
This Month 4
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (2)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |