1.0.0 • Published 8 years ago
str-reduce v1.0.0
str-reduce 
A dependency free way of reducing adjacent characters in a string limited by an amount.
Install
$ npm install --save str-reduceUsage
const strReduce = require('str-reduce');
strReduce('aaabb', 2);
//=> 'aabb'
strReduce('AAaaaBBbb', 2);
//=> AAaaBBbb
strReduce('this will reduce duplicate characters', 1)
//=> 'this wil reduce duplicate characters'
strReduce('****************************', 6)
//=> '******'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
1.0.0
8 years ago