You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* eslint-disable yoda */
  2. export default function isFullwidthCodePoint(codePoint) {
  3. if (!Number.isInteger(codePoint)) {
  4. return false;
  5. }
  6. // Code points are derived from:
  7. // https://unicode.org/Public/UNIDATA/EastAsianWidth.txt
  8. return codePoint >= 0x1100 && (
  9. codePoint <= 0x115F || // Hangul Jamo
  10. codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET
  11. codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET
  12. // CJK Radicals Supplement .. Enclosed CJK Letters and Months
  13. (0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) ||
  14. // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
  15. (0x3250 <= codePoint && codePoint <= 0x4DBF) ||
  16. // CJK Unified Ideographs .. Yi Radicals
  17. (0x4E00 <= codePoint && codePoint <= 0xA4C6) ||
  18. // Hangul Jamo Extended-A
  19. (0xA960 <= codePoint && codePoint <= 0xA97C) ||
  20. // Hangul Syllables
  21. (0xAC00 <= codePoint && codePoint <= 0xD7A3) ||
  22. // CJK Compatibility Ideographs
  23. (0xF900 <= codePoint && codePoint <= 0xFAFF) ||
  24. // Vertical Forms
  25. (0xFE10 <= codePoint && codePoint <= 0xFE19) ||
  26. // CJK Compatibility Forms .. Small Form Variants
  27. (0xFE30 <= codePoint && codePoint <= 0xFE6B) ||
  28. // Halfwidth and Fullwidth Forms
  29. (0xFF01 <= codePoint && codePoint <= 0xFF60) ||
  30. (0xFFE0 <= codePoint && codePoint <= 0xFFE6) ||
  31. // Kana Supplement
  32. (0x1B000 <= codePoint && codePoint <= 0x1B001) ||
  33. // Enclosed Ideographic Supplement
  34. (0x1F200 <= codePoint && codePoint <= 0x1F251) ||
  35. // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
  36. (0x20000 <= codePoint && codePoint <= 0x3FFFD)
  37. );
  38. }