3 module.exports = longestStreak
5 // Get the count of the longest repeating streak of `character` in `value`.
6 function longestStreak(value, character) {
12 if (typeof character !== 'string' || character.length !== 1) {
13 throw new Error('Expected character')
17 index = value.indexOf(character)
20 while (index !== -1) {
23 if (index === expected) {
24 if (count > maximum) {
32 index = value.indexOf(character, expected)