forgeplus-react/node_modules/string-length
zhiyuanliu cb17bad1d4 activity visualize step one 2023-07-29 06:19:10 -07:00
..
index.js activity visualize step one 2023-07-29 06:19:10 -07:00
license activity visualize step one 2023-07-29 06:19:10 -07:00
package.json activity visualize step one 2023-07-29 06:19:10 -07:00
readme.md activity visualize step one 2023-07-29 06:19:10 -07:00

readme.md

string-length Build Status

Get the real length of a string - by correctly counting astral symbols and ignoring ansi escape codes

String#length errornously counts astral symbols as two characters.

Install

$ npm install --save string-length

Usage

'🐴'.length;
//=> 2

stringLength('🐴');
//=> 1

stringLength('\u001b[1municorn\u001b[22m');
//=> 7

License

MIT © Sindre Sorhus