You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

longest-streak

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

longest-streak

Count the longest repeating streak of a substring

3.1.0
latest
Source
npmnpm
Version published
Weekly downloads
10M
2.6%
Maintainers
1
Weekly downloads
 
Created

What is longest-streak?

The 'longest-streak' npm package is designed to calculate the longest streak of consecutive characters in a given string. It is useful for analyzing text patterns, such as finding the most repeated character in a row in a text.

What are longest-streak's main functionalities?

Calculate longest consecutive character streak

This feature allows you to determine the length of the longest sequence of a repeated character in a string. In the provided code sample, the function returns '10' because the character 'e' repeats consecutively ten times, which is the longest streak in the string.

const longestStreak = require('longest-streak');
console.log(longestStreak('aaaabbaaccdeeeeeeeeee')); // Output: 10
0

Keywords

count

FAQs

Package last updated on 15 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts