Ohm-Management - Projektarbeit B-ME
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.

index.js 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. 'use strict';
  2. /* eslint-disable yoda */
  3. module.exports = x => {
  4. if (Number.isNaN(x)) {
  5. return false;
  6. }
  7. // code points are derived from:
  8. // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
  9. if (
  10. x >= 0x1100 && (
  11. x <= 0x115f || // Hangul Jamo
  12. x === 0x2329 || // LEFT-POINTING ANGLE BRACKET
  13. x === 0x232a || // RIGHT-POINTING ANGLE BRACKET
  14. // CJK Radicals Supplement .. Enclosed CJK Letters and Months
  15. (0x2e80 <= x && x <= 0x3247 && x !== 0x303f) ||
  16. // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
  17. (0x3250 <= x && x <= 0x4dbf) ||
  18. // CJK Unified Ideographs .. Yi Radicals
  19. (0x4e00 <= x && x <= 0xa4c6) ||
  20. // Hangul Jamo Extended-A
  21. (0xa960 <= x && x <= 0xa97c) ||
  22. // Hangul Syllables
  23. (0xac00 <= x && x <= 0xd7a3) ||
  24. // CJK Compatibility Ideographs
  25. (0xf900 <= x && x <= 0xfaff) ||
  26. // Vertical Forms
  27. (0xfe10 <= x && x <= 0xfe19) ||
  28. // CJK Compatibility Forms .. Small Form Variants
  29. (0xfe30 <= x && x <= 0xfe6b) ||
  30. // Halfwidth and Fullwidth Forms
  31. (0xff01 <= x && x <= 0xff60) ||
  32. (0xffe0 <= x && x <= 0xffe6) ||
  33. // Kana Supplement
  34. (0x1b000 <= x && x <= 0x1b001) ||
  35. // Enclosed Ideographic Supplement
  36. (0x1f200 <= x && x <= 0x1f251) ||
  37. // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
  38. (0x20000 <= x && x <= 0x3fffd)
  39. )
  40. ) {
  41. return true;
  42. }
  43. return false;
  44. };