str-reduce
A dependency free way of reducing adjacent characters in a string limited by an amount.
Install
$ npm install --save str-reduce
Usage
const strReduce = ; ;//=> 'aabb' ;//=> AAaaBBbb //=> 'this wil reduce duplicate characters' //=> '******'
API
strReduce(str, amount)
Takes in a str
of type string
and an amount
of type number
.
Returns a string
of the reduced str
where any same adacent characters are limited to the amount
specificed.
Tests
Clone the project and run npm test
in project root.
License
MIT © Lukasz Brodowski