unicode-string-width
Get the visual width of a unicode string - the number of columns required to display it
Handles:
- fullwidth characters
- ANSI escape codes escape codes (terminal corols)
- ASCII control characters
- additional variation selector characters in iOS/OSX
Install
$ npm install unicode-string-width
Usage
const unicodeStringWidth = ; ;//=> 2 ;//=> 5 ;//=> 1
License
- Unlicense (~Public Domain)
Related Work
- string-width - Same stuff, just with a bug. I should have probably just make a PR with a bug fix, but by the time I understood what the bug was, I had this fully functional :)