charcodes.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. export var charCodes; (function (charCodes) {
  2. const backSpace = 8; charCodes[charCodes["backSpace"] = backSpace] = "backSpace";
  3. const lineFeed = 10; charCodes[charCodes["lineFeed"] = lineFeed] = "lineFeed"; // '\n'
  4. const tab = 9; charCodes[charCodes["tab"] = tab] = "tab"; // '\t'
  5. const carriageReturn = 13; charCodes[charCodes["carriageReturn"] = carriageReturn] = "carriageReturn"; // '\r'
  6. const shiftOut = 14; charCodes[charCodes["shiftOut"] = shiftOut] = "shiftOut";
  7. const space = 32; charCodes[charCodes["space"] = space] = "space";
  8. const exclamationMark = 33; charCodes[charCodes["exclamationMark"] = exclamationMark] = "exclamationMark"; // '!'
  9. const quotationMark = 34; charCodes[charCodes["quotationMark"] = quotationMark] = "quotationMark"; // '"'
  10. const numberSign = 35; charCodes[charCodes["numberSign"] = numberSign] = "numberSign"; // '#'
  11. const dollarSign = 36; charCodes[charCodes["dollarSign"] = dollarSign] = "dollarSign"; // '$'
  12. const percentSign = 37; charCodes[charCodes["percentSign"] = percentSign] = "percentSign"; // '%'
  13. const ampersand = 38; charCodes[charCodes["ampersand"] = ampersand] = "ampersand"; // '&'
  14. const apostrophe = 39; charCodes[charCodes["apostrophe"] = apostrophe] = "apostrophe"; // '''
  15. const leftParenthesis = 40; charCodes[charCodes["leftParenthesis"] = leftParenthesis] = "leftParenthesis"; // '('
  16. const rightParenthesis = 41; charCodes[charCodes["rightParenthesis"] = rightParenthesis] = "rightParenthesis"; // ')'
  17. const asterisk = 42; charCodes[charCodes["asterisk"] = asterisk] = "asterisk"; // '*'
  18. const plusSign = 43; charCodes[charCodes["plusSign"] = plusSign] = "plusSign"; // '+'
  19. const comma = 44; charCodes[charCodes["comma"] = comma] = "comma"; // ','
  20. const dash = 45; charCodes[charCodes["dash"] = dash] = "dash"; // '-'
  21. const dot = 46; charCodes[charCodes["dot"] = dot] = "dot"; // '.'
  22. const slash = 47; charCodes[charCodes["slash"] = slash] = "slash"; // '/'
  23. const digit0 = 48; charCodes[charCodes["digit0"] = digit0] = "digit0"; // '0'
  24. const digit1 = 49; charCodes[charCodes["digit1"] = digit1] = "digit1"; // '1'
  25. const digit2 = 50; charCodes[charCodes["digit2"] = digit2] = "digit2"; // '2'
  26. const digit3 = 51; charCodes[charCodes["digit3"] = digit3] = "digit3"; // '3'
  27. const digit4 = 52; charCodes[charCodes["digit4"] = digit4] = "digit4"; // '4'
  28. const digit5 = 53; charCodes[charCodes["digit5"] = digit5] = "digit5"; // '5'
  29. const digit6 = 54; charCodes[charCodes["digit6"] = digit6] = "digit6"; // '6'
  30. const digit7 = 55; charCodes[charCodes["digit7"] = digit7] = "digit7"; // '7'
  31. const digit8 = 56; charCodes[charCodes["digit8"] = digit8] = "digit8"; // '8'
  32. const digit9 = 57; charCodes[charCodes["digit9"] = digit9] = "digit9"; // '9'
  33. const colon = 58; charCodes[charCodes["colon"] = colon] = "colon"; // ':'
  34. const semicolon = 59; charCodes[charCodes["semicolon"] = semicolon] = "semicolon"; // ';'
  35. const lessThan = 60; charCodes[charCodes["lessThan"] = lessThan] = "lessThan"; // '<'
  36. const equalsTo = 61; charCodes[charCodes["equalsTo"] = equalsTo] = "equalsTo"; // '='
  37. const greaterThan = 62; charCodes[charCodes["greaterThan"] = greaterThan] = "greaterThan"; // '>'
  38. const questionMark = 63; charCodes[charCodes["questionMark"] = questionMark] = "questionMark"; // '?'
  39. const atSign = 64; charCodes[charCodes["atSign"] = atSign] = "atSign"; // '@'
  40. const uppercaseA = 65; charCodes[charCodes["uppercaseA"] = uppercaseA] = "uppercaseA"; // 'A'
  41. const uppercaseB = 66; charCodes[charCodes["uppercaseB"] = uppercaseB] = "uppercaseB"; // 'B'
  42. const uppercaseC = 67; charCodes[charCodes["uppercaseC"] = uppercaseC] = "uppercaseC"; // 'C'
  43. const uppercaseD = 68; charCodes[charCodes["uppercaseD"] = uppercaseD] = "uppercaseD"; // 'D'
  44. const uppercaseE = 69; charCodes[charCodes["uppercaseE"] = uppercaseE] = "uppercaseE"; // 'E'
  45. const uppercaseF = 70; charCodes[charCodes["uppercaseF"] = uppercaseF] = "uppercaseF"; // 'F'
  46. const uppercaseG = 71; charCodes[charCodes["uppercaseG"] = uppercaseG] = "uppercaseG"; // 'G'
  47. const uppercaseH = 72; charCodes[charCodes["uppercaseH"] = uppercaseH] = "uppercaseH"; // 'H'
  48. const uppercaseI = 73; charCodes[charCodes["uppercaseI"] = uppercaseI] = "uppercaseI"; // 'I'
  49. const uppercaseJ = 74; charCodes[charCodes["uppercaseJ"] = uppercaseJ] = "uppercaseJ"; // 'J'
  50. const uppercaseK = 75; charCodes[charCodes["uppercaseK"] = uppercaseK] = "uppercaseK"; // 'K'
  51. const uppercaseL = 76; charCodes[charCodes["uppercaseL"] = uppercaseL] = "uppercaseL"; // 'L'
  52. const uppercaseM = 77; charCodes[charCodes["uppercaseM"] = uppercaseM] = "uppercaseM"; // 'M'
  53. const uppercaseN = 78; charCodes[charCodes["uppercaseN"] = uppercaseN] = "uppercaseN"; // 'N'
  54. const uppercaseO = 79; charCodes[charCodes["uppercaseO"] = uppercaseO] = "uppercaseO"; // 'O'
  55. const uppercaseP = 80; charCodes[charCodes["uppercaseP"] = uppercaseP] = "uppercaseP"; // 'P'
  56. const uppercaseQ = 81; charCodes[charCodes["uppercaseQ"] = uppercaseQ] = "uppercaseQ"; // 'Q'
  57. const uppercaseR = 82; charCodes[charCodes["uppercaseR"] = uppercaseR] = "uppercaseR"; // 'R'
  58. const uppercaseS = 83; charCodes[charCodes["uppercaseS"] = uppercaseS] = "uppercaseS"; // 'S'
  59. const uppercaseT = 84; charCodes[charCodes["uppercaseT"] = uppercaseT] = "uppercaseT"; // 'T'
  60. const uppercaseU = 85; charCodes[charCodes["uppercaseU"] = uppercaseU] = "uppercaseU"; // 'U'
  61. const uppercaseV = 86; charCodes[charCodes["uppercaseV"] = uppercaseV] = "uppercaseV"; // 'V'
  62. const uppercaseW = 87; charCodes[charCodes["uppercaseW"] = uppercaseW] = "uppercaseW"; // 'W'
  63. const uppercaseX = 88; charCodes[charCodes["uppercaseX"] = uppercaseX] = "uppercaseX"; // 'X'
  64. const uppercaseY = 89; charCodes[charCodes["uppercaseY"] = uppercaseY] = "uppercaseY"; // 'Y'
  65. const uppercaseZ = 90; charCodes[charCodes["uppercaseZ"] = uppercaseZ] = "uppercaseZ"; // 'Z'
  66. const leftSquareBracket = 91; charCodes[charCodes["leftSquareBracket"] = leftSquareBracket] = "leftSquareBracket"; // '['
  67. const backslash = 92; charCodes[charCodes["backslash"] = backslash] = "backslash"; // '\ '
  68. const rightSquareBracket = 93; charCodes[charCodes["rightSquareBracket"] = rightSquareBracket] = "rightSquareBracket"; // ']'
  69. const caret = 94; charCodes[charCodes["caret"] = caret] = "caret"; // '^'
  70. const underscore = 95; charCodes[charCodes["underscore"] = underscore] = "underscore"; // '_'
  71. const graveAccent = 96; charCodes[charCodes["graveAccent"] = graveAccent] = "graveAccent"; // '`'
  72. const lowercaseA = 97; charCodes[charCodes["lowercaseA"] = lowercaseA] = "lowercaseA"; // 'a'
  73. const lowercaseB = 98; charCodes[charCodes["lowercaseB"] = lowercaseB] = "lowercaseB"; // 'b'
  74. const lowercaseC = 99; charCodes[charCodes["lowercaseC"] = lowercaseC] = "lowercaseC"; // 'c'
  75. const lowercaseD = 100; charCodes[charCodes["lowercaseD"] = lowercaseD] = "lowercaseD"; // 'd'
  76. const lowercaseE = 101; charCodes[charCodes["lowercaseE"] = lowercaseE] = "lowercaseE"; // 'e'
  77. const lowercaseF = 102; charCodes[charCodes["lowercaseF"] = lowercaseF] = "lowercaseF"; // 'f'
  78. const lowercaseG = 103; charCodes[charCodes["lowercaseG"] = lowercaseG] = "lowercaseG"; // 'g'
  79. const lowercaseH = 104; charCodes[charCodes["lowercaseH"] = lowercaseH] = "lowercaseH"; // 'h'
  80. const lowercaseI = 105; charCodes[charCodes["lowercaseI"] = lowercaseI] = "lowercaseI"; // 'i'
  81. const lowercaseJ = 106; charCodes[charCodes["lowercaseJ"] = lowercaseJ] = "lowercaseJ"; // 'j'
  82. const lowercaseK = 107; charCodes[charCodes["lowercaseK"] = lowercaseK] = "lowercaseK"; // 'k'
  83. const lowercaseL = 108; charCodes[charCodes["lowercaseL"] = lowercaseL] = "lowercaseL"; // 'l'
  84. const lowercaseM = 109; charCodes[charCodes["lowercaseM"] = lowercaseM] = "lowercaseM"; // 'm'
  85. const lowercaseN = 110; charCodes[charCodes["lowercaseN"] = lowercaseN] = "lowercaseN"; // 'n'
  86. const lowercaseO = 111; charCodes[charCodes["lowercaseO"] = lowercaseO] = "lowercaseO"; // 'o'
  87. const lowercaseP = 112; charCodes[charCodes["lowercaseP"] = lowercaseP] = "lowercaseP"; // 'p'
  88. const lowercaseQ = 113; charCodes[charCodes["lowercaseQ"] = lowercaseQ] = "lowercaseQ"; // 'q'
  89. const lowercaseR = 114; charCodes[charCodes["lowercaseR"] = lowercaseR] = "lowercaseR"; // 'r'
  90. const lowercaseS = 115; charCodes[charCodes["lowercaseS"] = lowercaseS] = "lowercaseS"; // 's'
  91. const lowercaseT = 116; charCodes[charCodes["lowercaseT"] = lowercaseT] = "lowercaseT"; // 't'
  92. const lowercaseU = 117; charCodes[charCodes["lowercaseU"] = lowercaseU] = "lowercaseU"; // 'u'
  93. const lowercaseV = 118; charCodes[charCodes["lowercaseV"] = lowercaseV] = "lowercaseV"; // 'v'
  94. const lowercaseW = 119; charCodes[charCodes["lowercaseW"] = lowercaseW] = "lowercaseW"; // 'w'
  95. const lowercaseX = 120; charCodes[charCodes["lowercaseX"] = lowercaseX] = "lowercaseX"; // 'x'
  96. const lowercaseY = 121; charCodes[charCodes["lowercaseY"] = lowercaseY] = "lowercaseY"; // 'y'
  97. const lowercaseZ = 122; charCodes[charCodes["lowercaseZ"] = lowercaseZ] = "lowercaseZ"; // 'z'
  98. const leftCurlyBrace = 123; charCodes[charCodes["leftCurlyBrace"] = leftCurlyBrace] = "leftCurlyBrace"; // '{'
  99. const verticalBar = 124; charCodes[charCodes["verticalBar"] = verticalBar] = "verticalBar"; // '|'
  100. const rightCurlyBrace = 125; charCodes[charCodes["rightCurlyBrace"] = rightCurlyBrace] = "rightCurlyBrace"; // '}'
  101. const tilde = 126; charCodes[charCodes["tilde"] = tilde] = "tilde"; // '~'
  102. const nonBreakingSpace = 160; charCodes[charCodes["nonBreakingSpace"] = nonBreakingSpace] = "nonBreakingSpace";
  103. // eslint-disable-next-line no-irregular-whitespace
  104. const oghamSpaceMark = 5760; charCodes[charCodes["oghamSpaceMark"] = oghamSpaceMark] = "oghamSpaceMark"; // ' '
  105. const lineSeparator = 8232; charCodes[charCodes["lineSeparator"] = lineSeparator] = "lineSeparator";
  106. const paragraphSeparator = 8233; charCodes[charCodes["paragraphSeparator"] = paragraphSeparator] = "paragraphSeparator";
  107. })(charCodes || (charCodes = {}));
  108. export function isDigit(code) {
  109. return (
  110. (code >= charCodes.digit0 && code <= charCodes.digit9) ||
  111. (code >= charCodes.lowercaseA && code <= charCodes.lowercaseF) ||
  112. (code >= charCodes.uppercaseA && code <= charCodes.uppercaseF)
  113. );
  114. }