Neutrinos Peludos Magnéticos

    longest-streak
    TypeScript icon, indicating that this package has built-in type declarations

    3.0.1 • Public • Published

    longest-streak

    Build Coverage Downloads Size

    Get the count of the longest repeating streak of character in value.

    Contents

    Install

    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>

    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 to search in
    • 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

    Types

    This package is fully typed with TypeScript.

    Compatibility

    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.

    Security

    This package is safe.

    Related

    Contribute

    Yes please! See How to Contribute to Open Source.

    License

    MIT © Titus Wormer

    Install

    npm i longest-streak

    DownloadsWeekly Downloads

    3,287,221

    Version

    3.0.1

    License

    MIT

    Unpacked Size

    7.31 kB

    Total Files

    5

    Last publish

    Collaborators

    • wooorm