• Home
Name Date Size #Lines LOC

..--

docs/12-May-2024-6652

test/12-May-2024-6553

.npmignoreD12-May-202413 21

LICENSED12-May-20241.5 KiB3123

Readme.mdD12-May-2024887 3421

combining.jsD12-May-20243 KiB5150

index.jsD12-May-20243.1 KiB10058

package.jsonD12-May-20241.6 KiB7473

Readme.md

1# wcwidth
2
3Determine columns needed for a fixed-size wide-character string
4
5----
6
7wcwidth is a simple JavaScript port of [wcwidth](http://man7.org/linux/man-pages/man3/wcswidth.3.html) implemented in C by Markus Kuhn.
8
9JavaScript port [originally](https://github.com/mycoboco/wcwidth.js) written by Woong Jun <woong.jun@gmail.com> (http://code.woong.org/)
10
11## Example
12
13```js
14'한'.length    // => 1
15wcwidth('한');   // => 2
16
17'한글'.length    // => 2
18wcwidth('한글'); // => 4
19```
20
21`wcwidth()` and its string version, `wcswidth()` are defined by IEEE Std
221002.1-2001, a.k.a. POSIX.1-2001, and return the number of columns used
23to represent the given wide character and string.
24
25Markus's implementation assumes the wide character given to those
26functions to be encoded in ISO 10646, which is almost true for
27JavaScript's characters.
28
29[Further explaination here](docs)
30
31## License
32
33MIT
34