Blazing Fast Unicode Character Width Calculation: O(1) wcwidth in JS
2025-09-13
Introducing `wcwidth-o1`, a TypeScript/JavaScript library providing O(1) performance for calculating Unicode character widths. Fully supporting Unicode 15.1, this optimized port of Markus Kuhn's implementation is perfect for ensuring correct text alignment in terminals and other applications. Functions like `wcwidth`, `wcswidth`, and `wcswidthCjk` handle single characters, strings, and CJK characters respectively, adhering to Unicode width class rules (e.g., fullwidth characters occupy two columns).
Development
character width