• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..20-Sep-2020-

docs/H20-Sep-2020-6652

test/H03-May-2022-

.npmignoreH A D26-Oct-198513 21

LICENSEH A D26-Oct-19851.5 KiB3123

Readme.mdH A D26-Oct-1985887 3421

package.jsonH A D20-Sep-20201.6 KiB7372

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