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.
$ npm install --save longest-length
var longestLength = require('longest-length');
longestLength('Supercalifragilisticexpialidocious is long word')
//=> 34
longestLength('\u001b[1mthis\u001b[22m is a dummy text')
//=> 5
longestLength('🦄🍺🦄')
//=> 3
Required
Type: string
Type: boolean
Default: true
Get the real length of a string.
Type: regex
Default: /\S+/g
Regex used to split text in words.
MIT © Danilo Sampaio