UNPKG

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