basant307/AI_Governance_Project
048
1# longest-streak2 3[![Build][build-badge]][build]4[![Coverage][coverage-badge]][coverage]5[![Downloads][downloads-badge]][downloads]6[![Size][size-badge]][size]7 8Get the count of the longest repeating streak of `substring` in `value`.9 10## Contents11 12* [What is this?](#what-is-this)13* [When should I use this?](#when-should-i-use-this)14* [Install](#install)15* [Use](#use)16* [API](#api)17 * [`longestStreak(value, substring)`](#longeststreakvalue-substring)18* [Types](#types)19* [Compatibility](#compatibility)20* [Security](#security)21* [Related](#related)22* [Contribute](#contribute)23* [License](#license)24 25## What is this?26 27This is a tiny package that finds the count of the longest adjacent repeating28substring.29 30## When should I use this?31 32This package is rather niche.33I use it for serializing markdown ASTs (particularly fenced code and math).34 35You can use [`ccount`][ccount] if you need the total count of substrings36occuring in a value.37 38## Install39 40This package is [ESM only][esm].41In Node.js (version 14.14+, 16.0+), install with [npm][]:42 43```sh44npm install longest-streak45```46 47In Deno with [`esm.sh`][esmsh]:48 49```js50import {longestStreak} from 'https://esm.sh/longest-streak@3'51```52 53In browsers with [`esm.sh`][esmsh]:54 55```html56<script type="module">57 import {longestStreak} from 'https://esm.sh/longest-streak@3?bundle'58</script>59```60 61## Use62 63```js64import {longestStreak} from 'longest-streak'65 66longestStreak('` foo `` bar `', '`') // => 267```68 69## API70 71This package exports the identifier `longestStreak`.72There is no default export.73 74### `longestStreak(value, substring)`75 76Get the count of the longest repeating streak of `substring` in `value`.77 78###### Parameters79 80* `value` (`string`) — content to search in81* `substring` (`string`) — substring to look for, typically one character82 83###### Returns84 85Count of most frequent adjacent `substring`s in `value` (`number`).86 87## Types88 89This package is fully typed with [TypeScript][].90It exports no additional types.91 92## Compatibility93 94This package is at least compatible with all maintained versions of Node.js.95As of now, that is Node.js 14.14+ and 16.0+.96It also works in Deno and modern browsers.97 98## Security99 100This package is safe.101 102## Related103 104* [`wooorm/ccount`](https://github.com/wooorm/ccount)105 — count the total number of `substring`s in `value`106* [`wooorm/direction`](https://github.com/wooorm/direction)107 — detect directionality: left-to-right, right-to-left, or neutral108 109## Contribute110 111Yes please!112See [How to Contribute to Open Source][contribute].113 114## License115 116[MIT][license] © [Titus Wormer][author]117 118<!-- Definitions -->119 120[build-badge]: https://github.com/wooorm/longest-streak/workflows/main/badge.svg121 122[build]: https://github.com/wooorm/longest-streak/actions123 124[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/longest-streak.svg125 126[coverage]: https://codecov.io/github/wooorm/longest-streak127 128[downloads-badge]: https://img.shields.io/npm/dm/longest-streak.svg129 130[downloads]: https://www.npmjs.com/package/longest-streak131 132[size-badge]: https://img.shields.io/bundlephobia/minzip/longest-streak.svg133 134[size]: https://bundlephobia.com/result?p=longest-streak135 136[npm]: https://docs.npmjs.com/cli/install137 138[esmsh]: https://esm.sh139 140[license]: license141 142[author]: https://wooorm.com143 144[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c145 146[typescript]: https://www.typescriptlang.org147 148[contribute]: https://opensource.guide/how-to-contribute/149 150[ccount]: https://github.com/wooorm/ccount151 