string-length
Advanced tools
Weekly downloads
Readme
Get the real length of a string - by correctly counting astral symbols and ignoring ansi escape codes
String#length
erroneously counts astral symbols as two characters.
$ npm install string-length
import stringLength from 'string-length';
'🐴'.length;
//=> 2
stringLength('🐴');
//=> 1
stringLength('\u001B[1municorn\u001B[22m');
//=> 7
Type: object
Type: boolean
Default: false
Whether ANSI escape codes should be counted. They are ignored by default.
FAQs
Get the real length of a string - by correctly counting astral symbols and ignoring ansi escape codes
The npm package string-length receives a total of 21,483,011 weekly downloads. As such, string-length popularity was classified as popular.
We found that string-length demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.