Socket
Socket
Sign inDemoInstall

longest-length

Package Overview
Dependencies
3
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    longest-length

Get the length of the longest word in a string. It also correctly calculates the length of the words containing ANSI escape codes.


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

longest-length Build Status

Get the length of the longest word in a string. It also correctly calculates the length of the words containing ANSI escape codes and astral symbols.

Install

$ npm install --save longest-length

Usage

var longestLength = require('longest-length');

longestLength('Supercalifragilisticexpialidocious is long word')
//=> 34


longestLength('\u001b[1mthis\u001b[22m is a dummy text')
//=> 5

longestLength('🦄🍺🦄')
//=> 3

API

longestLength(input, [options])

input

Required
Type: string

options
stripAnsiCodes

Type: boolean
Default: true

Get the real length of a string.

splitRegex

Type: regex
Default: /\S+/g

Regex used to split text in words.

License

MIT © Danilo Sampaio

Keywords

FAQs

Last updated on 30 Nov 2016

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc