unicode-string-width

0.1.0 • Public • Published

unicode-string-width

Get the visual width of a unicode string - the number of columns required to display it

Handles:

Install

$ npm install unicode-string-width

Usage

const unicodeStringWidth = require('unicode-string-width');
 
unicodeStringWidth('');
//=> 2
 
unicodeStringWidth('\u001b[1mဤဥဩဪါ\u001b[22m');
//=> 5
 
unicodeStringWidth('a');
//=> 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 :)

Dependents (1)

Package Sidebar

Install

npm i unicode-string-width

Weekly Downloads

5

Version

0.1.0

License

Unlicense

Unpacked Size

127 kB

Total Files

9

Last publish

Collaborators

  • unjello