Sha256: 76c6e8b8cf82bded1676fa069bd1f86a7bce6a1acdab34296465d1e1c4090f6e

Contents?: true

Size: 1.51 KB

Versions: 24

Compression:

Stored size: 1.51 KB

Contents

# longest-streak

[![Build][build-badge]][build]
[![Coverage][coverage-badge]][coverage]
[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]

Count the longest repeating streak of a character.

## Install

[npm][]:

```sh
npm install longest-streak
```

## Use

```js
var longestStreak = require('longest-streak')

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

## API

### `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` — Number of characters at the place where `character` occurs in
its longest streak in `value`.

###### Throws

*   `Error` — when `character` is not a single character string.

## License

[MIT][license] © [Titus Wormer][author]

<!-- Definitions -->

[build-badge]: https://img.shields.io/travis/wooorm/longest-streak.svg

[build]: https://travis-ci.org/wooorm/longest-streak

[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/longest-streak.svg

[coverage]: https://codecov.io/github/wooorm/longest-streak

[downloads-badge]: https://img.shields.io/npm/dm/longest-streak.svg

[downloads]: https://www.npmjs.com/package/longest-streak

[size-badge]: https://img.shields.io/bundlephobia/minzip/longest-streak.svg

[size]: https://bundlephobia.com/result?p=longest-streak

[npm]: https://docs.npmjs.com/cli/install

[license]: license

[author]: https://wooorm.com

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
trusty-cms-6.3.1 node_modules/longest-streak/readme.md
trusty-cms-5.0.7 node_modules/longest-streak/readme.md
trusty-cms-5.0.6 node_modules/longest-streak/readme.md
trusty-cms-5.0.5 node_modules/longest-streak/readme.md
trusty-cms-5.0.4 node_modules/longest-streak/readme.md
trusty-cms-5.0.3 node_modules/longest-streak/readme.md
trusty-cms-5.0.2 node_modules/longest-streak/readme.md
trusty-cms-5.0.1 node_modules/longest-streak/readme.md
trusty-cms-4.3.5 node_modules/longest-streak/readme.md
trusty-cms-5.0.0 node_modules/longest-streak/readme.md
trusty-cms-4.3.4 node_modules/longest-streak/readme.md
trusty-cms-4.3.3 node_modules/longest-streak/readme.md
trusty-cms-4.3.2 node_modules/longest-streak/readme.md
trusty-cms-4.3.1 node_modules/longest-streak/readme.md
trusty-cms-4.3 node_modules/longest-streak/readme.md
trusty-cms-4.2.3 node_modules/longest-streak/readme.md
trusty-cms-4.2.2 node_modules/longest-streak/readme.md
trusty-cms-4.2.1 node_modules/longest-streak/readme.md
trusty-cms-4.2 node_modules/longest-streak/readme.md
trusty-cms-4.1.9 node_modules/longest-streak/readme.md