UI for Zipcoin Blue

index.js 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. 'use strict';
  2. var numberIsNan = require('number-is-nan');
  3. module.exports = function (x) {
  4. if (numberIsNan(x)) {
  5. return false;
  6. }
  7. // https://github.com/nodejs/io.js/blob/cff7300a578be1b10001f2d967aaedc88aee6402/lib/readline.js#L1369
  8. // code points are derived from:
  9. // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
  10. if (x >= 0x1100 && (
  11. x <= 0x115f || // Hangul Jamo
  12. 0x2329 === x || // LEFT-POINTING ANGLE BRACKET
  13. 0x232a === x || // 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. return true;
  40. }
  41. return false;
  42. }