'use strict'

/* Expose. */
module.exports = longestStreak

/* Get the count of the longest repeating streak of
 * `character` in `value`. */
function longestStreak(value, character) {
  var count = 0
  var maximum = 0
  var expected
  var index

  if (typeof character !== 'string' || character.length !== 1) {
    throw new Error('Expected character')
  }

  value = String(value)
  index = value.indexOf(character)
  expected = index

  while (index !== -1) {
    count++

    if (index === expected) {
      if (count > maximum) {
        maximum = count
      }
    } else {
      count = 1
    }

    expected = index + 1
    index = value.indexOf(character, expected)
  }

  return maximum
}

@@ -11,22 +11,8 @@
 t'%0A%0A
-/* Expose. */%0A
 modu
@@ -40,17 +40,17 @@
 treak%0A%0A/
-*
+/
  Get the
@@ -94,11 +94,8 @@
 k of
-%0A *
  %60ch
@@ -118,11 +118,8 @@
 ue%60.
- */
 %0Afun

Refactor comment-style