5e39a1398b2aa0e8a2e4e06182359e15caa106277b5ece647e810d6524b4c6504d28fea1cc58e39b0ad3e7139f42064d6d19c829a6aeb7c9df0f0c4f502f93 887 B

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