$ cnpm install longest-streak
Count the longest repeating streak of a character.
This package is ESM only: Node 12+ is needed to use it and it must be import
ed
instead of require
d.
npm:
npm install longest-streak
import {longestStreak} from 'longest-streak'
longestStreak('` foo `` bar `', '`') // => 2
This package exports the following identifiers: longestStreak
.
There is no default export.
longestStreak(value, character)
Get the count of the longest repeating streak of character
in value
.
value
(string
) — Content, coerced to string.character
(string
) — Single character to look for.number
— Count of most frequent adjacent character
s in value
Error
— when character
is not a single character string.Copyright 2013 - present © cnpmjs.org