You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readme.md 819B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # trim-repeated [![Build Status](https://travis-ci.org/sindresorhus/trim-repeated.svg?branch=master)](https://travis-ci.org/sindresorhus/trim-repeated)
  2. > Trim a consecutively repeated substring: `foo--bar---baz` → `foo-bar-baz`
  3. ## Install
  4. ```
  5. $ npm install --save trim-repeated
  6. ```
  7. ## Usage
  8. ```js
  9. var trimRepeated = require('trim-repeated');
  10. trimRepeated('foo--bar---baz', '-');
  11. //=> 'foo-bar-baz'
  12. trimRepeated('foo@#@#baz', '@#');
  13. //=> 'foo@#baz'
  14. ```
  15. ### trimRepeated(input, target)
  16. #### input
  17. *Required*
  18. Type: `string`
  19. #### target
  20. *Required*
  21. Type: `string`
  22. Substring to trim.
  23. ## Related
  24. - [`condense-whitespace`](https://github.com/sindresorhus/condense-whitespace) - Remove leading, trailing and repeated whitespace from a string
  25. ## License
  26. MIT © [Sindre Sorhus](http://sindresorhus.com)