$ cnpm install longest-streak
Get the count of the longest repeating streak of character
in value
.
This package is ESM only. In Node.js (version 12.20+, 14.14+, or 16.0+), install with npm:
npm install longest-streak
In Deno with Skypack:
import {longestStreak} from 'https://cdn.skypack.dev/longest-streak@3?dts'
In browsers with Skypack:
<script type="module">
import {longestStreak} from 'https://cdn.skypack.dev/longest-streak@3?min'
</script>
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 to search incharacter
(string
) — single character to look fornumber
— count of most frequent adjacent character
s in value
.
Error
— when character
is not a single character stringThis package is fully typed with TypeScript.
This package is at least compatible with all maintained versions of Node.js. As of now, that is Node.js 12.20+, 14.14+, and 16.0+. It also works in Deno and modern browsers.
This package is safe.
wooorm/ccount
— count characterswooorm/direction
— detect directionality: left-to-right, right-to-left, or neutralYes please! See How to Contribute to Open Source.
Copyright 2013 - present © cnpmjs.org