longest-streak
Count the longest repeating streak of a character
Last updated 4 years ago by wooorm .
MIT · Repository · Bugs · Original npm
$ cnpm install longest-streak 
SYNC missed versions from official npm registry.

longest-streak

Build Coverage Downloads Size

Count the longest repeating streak of a character.

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install longest-streak

Use

import {longestStreak} from 'longest-streak'

longestStreak('` foo `` bar `', '`') // => 2

API

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.

Parameters
  • value (string) — Content, coerced to string.
  • character (string) — Single character to look for.
Returns

number — Count of most frequent adjacent characters in value

Throws
  • Error — when character is not a single character string.

License

MIT © Titus Wormer

Current Tags

  • 3.1.0                                ...           latest (3 years ago)

6 Versions

  • 3.1.0                                ...           3 years ago
  • 3.0.1                                ...           4 years ago
  • 3.0.0                                ...           4 years ago
  • 2.0.2                                ...           8 years ago
  • 1.0.0                                ...           10 years ago
  • 2.0.4                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (9)
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org