Top
Best
New

Posted by dawson0 9/13/2025

Show HN: wcwidth-o1 – Find Unicode text cell width in no time for JavaScript/TS(github.com)
I ported Markus Kuhn’s wcwidth to TypeScript and optimized it with bitset lookups for O(1) performance. It now covers the full Unicode 15.1 combining ranges.

GitHub: https://github.com/dawsonhuang0/Wcwidth-O1 NPM: https://www.npmjs.com/package/wcwidth-o1

Feedback welcome!

16 points | 4 comments
jv22222 9/13/2025|
I was about to say you could figure this kind of thing out with Intl.Segmenter but then saw it was a different problem. Nice.
shawn_w 9/13/2025||
Now you just have to update it to the just-released Unicode 17.
dawson0 9/15/2025|
Thanks for pointing it out! The latest version is now based on Unicode 17.0.0.
peter-m80 9/13/2025|
Nice