Skip to content

mrozio13pl/wcwidth

Repository files navigation

wcwidth npm

Dead simple, tiny (~2.3 kB) port of wcwidth implemented in C by Markus Kuhn.

npm i @mrozio/wcwidth
import { wcwidth, wcswidth } from '@mrozio/wcwidth';

'嘿'.length; // <= 1
wcwidth('嘿'.charCodeAt()); // <= 2

'我讨厌 JavaScript'.length; // <= 14
wcswidth('我讨厌 JavaScript'); // <= 17

License

MIT 💖