logisheets-core 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/craft-interactions/index.d.ts +140 -0
  2. package/dist/craft-interactions/index.js +462 -0
  3. package/dist/field/index.d.ts +51 -0
  4. package/dist/field/index.js +70 -0
  5. package/dist/format/index.d.ts +21 -0
  6. package/dist/format/index.js +454 -0
  7. package/dist/index.d.ts +12 -0
  8. package/dist/index.js +17 -0
  9. package/dist/ops/index.d.ts +155 -0
  10. package/dist/ops/index.js +335 -0
  11. package/dist/permissions/index.d.ts +32 -0
  12. package/dist/permissions/index.js +74 -0
  13. package/dist/port.d.ts +9 -0
  14. package/dist/port.js +14 -0
  15. package/dist/selection/index.d.ts +1 -0
  16. package/dist/selection/index.js +1 -0
  17. package/dist/selection/model.d.ts +10 -0
  18. package/dist/selection/model.js +38 -0
  19. package/dist/strings/case.d.ts +2 -0
  20. package/dist/strings/case.js +6 -0
  21. package/dist/strings/char-code.d.ts +422 -0
  22. package/dist/strings/char-code.js +424 -0
  23. package/dist/strings/common_length.d.ts +4 -0
  24. package/dist/strings/common_length.js +28 -0
  25. package/dist/strings/contain.d.ts +4 -0
  26. package/dist/strings/contain.js +60 -0
  27. package/dist/strings/index.d.ts +5 -0
  28. package/dist/strings/index.js +5 -0
  29. package/dist/strings/judges.d.ts +3 -0
  30. package/dist/strings/judges.js +38 -0
  31. package/dist/strings/surrogate.d.ts +16 -0
  32. package/dist/strings/surrogate.js +30 -0
  33. package/dist/structured/index.d.ts +41 -0
  34. package/dist/structured/index.js +50 -0
  35. package/dist/transaction/index.d.ts +8 -0
  36. package/dist/transaction/index.js +11 -0
  37. package/dist/type-guard/index.d.ts +3 -0
  38. package/dist/type-guard/index.js +3 -0
  39. package/dist/type-guard/propterty.d.ts +1 -0
  40. package/dist/type-guard/propterty.js +3 -0
  41. package/dist/type-guard/string.d.ts +1 -0
  42. package/dist/type-guard/string.js +3 -0
  43. package/dist/type-guard/u8.d.ts +1 -0
  44. package/dist/type-guard/u8.js +3 -0
  45. package/dist/utils/a1notation.d.ts +18 -0
  46. package/dist/utils/a1notation.js +76 -0
  47. package/dist/utils/array.d.ts +2 -0
  48. package/dist/utils/array.js +12 -0
  49. package/dist/utils/clone.d.ts +2 -0
  50. package/dist/utils/clone.js +25 -0
  51. package/dist/utils/const.d.ts +7 -0
  52. package/dist/utils/const.js +8 -0
  53. package/dist/utils/equal.d.ts +1 -0
  54. package/dist/utils/equal.js +11 -0
  55. package/dist/utils/index.d.ts +6 -0
  56. package/dist/utils/index.js +6 -0
  57. package/dist/utils/uuid.d.ts +1 -0
  58. package/dist/utils/uuid.js +4 -0
  59. package/dist/validation/index.d.ts +34 -0
  60. package/dist/validation/index.js +60 -0
  61. package/dist/value/index.d.ts +9 -0
  62. package/dist/value/index.js +49 -0
  63. package/package.json +54 -0
@@ -0,0 +1,424 @@
1
+ /**
2
+ * An inlined enum containing useful character codes (to be used with String.charCodeAt).
3
+ * Please leave the const keyword such that it gets inlined when compiled to JavaScript!
4
+ */
5
+ export var CharCode;
6
+ (function (CharCode) {
7
+ CharCode[CharCode["Null"] = 0] = "Null";
8
+ /**
9
+ * The `\b` character.
10
+ */
11
+ CharCode[CharCode["Backspace"] = 8] = "Backspace";
12
+ /**
13
+ * The `\t` character.
14
+ */
15
+ CharCode[CharCode["Tab"] = 9] = "Tab";
16
+ /**
17
+ * The `\n` character.
18
+ */
19
+ CharCode[CharCode["LineFeed"] = 10] = "LineFeed";
20
+ /**
21
+ * The `\r` character.
22
+ */
23
+ CharCode[CharCode["CarriageReturn"] = 13] = "CarriageReturn";
24
+ CharCode[CharCode["Space"] = 32] = "Space";
25
+ /**
26
+ * The `!` character.
27
+ */
28
+ CharCode[CharCode["ExclamationMark"] = 33] = "ExclamationMark";
29
+ /**
30
+ * The `"` character.
31
+ */
32
+ CharCode[CharCode["DoubleQuote"] = 34] = "DoubleQuote";
33
+ /**
34
+ * The `#` character.
35
+ */
36
+ CharCode[CharCode["Hash"] = 35] = "Hash";
37
+ /**
38
+ * The `$` character.
39
+ */
40
+ CharCode[CharCode["DollarSign"] = 36] = "DollarSign";
41
+ /**
42
+ * The `%` character.
43
+ */
44
+ CharCode[CharCode["PercentSign"] = 37] = "PercentSign";
45
+ /**
46
+ * The `&` character.
47
+ */
48
+ CharCode[CharCode["Ampersand"] = 38] = "Ampersand";
49
+ /**
50
+ * The `'` character.
51
+ */
52
+ CharCode[CharCode["SingleQuote"] = 39] = "SingleQuote";
53
+ /**
54
+ * The `(` character.
55
+ */
56
+ CharCode[CharCode["OpenParen"] = 40] = "OpenParen";
57
+ /**
58
+ * The `)` character.
59
+ */
60
+ CharCode[CharCode["CloseParen"] = 41] = "CloseParen";
61
+ /**
62
+ * The `*` character.
63
+ */
64
+ CharCode[CharCode["Asterisk"] = 42] = "Asterisk";
65
+ /**
66
+ * The `+` character.
67
+ */
68
+ CharCode[CharCode["Plus"] = 43] = "Plus";
69
+ /**
70
+ * The `,` character.
71
+ */
72
+ CharCode[CharCode["Comma"] = 44] = "Comma";
73
+ /**
74
+ * The `-` character.
75
+ */
76
+ CharCode[CharCode["Dash"] = 45] = "Dash";
77
+ /**
78
+ * The `.` character.
79
+ */
80
+ CharCode[CharCode["Period"] = 46] = "Period";
81
+ /**
82
+ * The `/` character.
83
+ */
84
+ CharCode[CharCode["Slash"] = 47] = "Slash";
85
+ CharCode[CharCode["Digit0"] = 48] = "Digit0";
86
+ CharCode[CharCode["Digit1"] = 49] = "Digit1";
87
+ CharCode[CharCode["Digit2"] = 50] = "Digit2";
88
+ CharCode[CharCode["Digit3"] = 51] = "Digit3";
89
+ CharCode[CharCode["Digit4"] = 52] = "Digit4";
90
+ CharCode[CharCode["Digit5"] = 53] = "Digit5";
91
+ CharCode[CharCode["Digit6"] = 54] = "Digit6";
92
+ CharCode[CharCode["Digit7"] = 55] = "Digit7";
93
+ CharCode[CharCode["Digit8"] = 56] = "Digit8";
94
+ CharCode[CharCode["Digit9"] = 57] = "Digit9";
95
+ /**
96
+ * The `:` character.
97
+ */
98
+ CharCode[CharCode["Colon"] = 58] = "Colon";
99
+ /**
100
+ * The `;` character.
101
+ */
102
+ CharCode[CharCode["Semicolon"] = 59] = "Semicolon";
103
+ /**
104
+ * The `<` character.
105
+ */
106
+ CharCode[CharCode["LessThan"] = 60] = "LessThan";
107
+ /**
108
+ * The `=` character.
109
+ */
110
+ CharCode[CharCode["Equals"] = 61] = "Equals";
111
+ /**
112
+ * The `>` character.
113
+ */
114
+ CharCode[CharCode["GreaterThan"] = 62] = "GreaterThan";
115
+ /**
116
+ * The `?` character.
117
+ */
118
+ CharCode[CharCode["QuestionMark"] = 63] = "QuestionMark";
119
+ /**
120
+ * The `@` character.
121
+ */
122
+ CharCode[CharCode["AtSign"] = 64] = "AtSign";
123
+ CharCode[CharCode["A"] = 65] = "A";
124
+ CharCode[CharCode["B"] = 66] = "B";
125
+ CharCode[CharCode["C"] = 67] = "C";
126
+ CharCode[CharCode["D"] = 68] = "D";
127
+ CharCode[CharCode["E"] = 69] = "E";
128
+ CharCode[CharCode["F"] = 70] = "F";
129
+ CharCode[CharCode["G"] = 71] = "G";
130
+ CharCode[CharCode["H"] = 72] = "H";
131
+ CharCode[CharCode["I"] = 73] = "I";
132
+ CharCode[CharCode["J"] = 74] = "J";
133
+ CharCode[CharCode["K"] = 75] = "K";
134
+ CharCode[CharCode["L"] = 76] = "L";
135
+ CharCode[CharCode["M"] = 77] = "M";
136
+ CharCode[CharCode["N"] = 78] = "N";
137
+ CharCode[CharCode["O"] = 79] = "O";
138
+ CharCode[CharCode["P"] = 80] = "P";
139
+ CharCode[CharCode["Q"] = 81] = "Q";
140
+ CharCode[CharCode["R"] = 82] = "R";
141
+ CharCode[CharCode["S"] = 83] = "S";
142
+ CharCode[CharCode["T"] = 84] = "T";
143
+ CharCode[CharCode["U"] = 85] = "U";
144
+ CharCode[CharCode["V"] = 86] = "V";
145
+ CharCode[CharCode["W"] = 87] = "W";
146
+ CharCode[CharCode["X"] = 88] = "X";
147
+ CharCode[CharCode["Y"] = 89] = "Y";
148
+ CharCode[CharCode["Z"] = 90] = "Z";
149
+ /**
150
+ * The `[` character.
151
+ */
152
+ CharCode[CharCode["OpenSquareBracket"] = 91] = "OpenSquareBracket";
153
+ /**
154
+ * The `\` character.
155
+ */
156
+ CharCode[CharCode["Backslash"] = 92] = "Backslash";
157
+ /**
158
+ * The `]` character.
159
+ */
160
+ CharCode[CharCode["CloseSquareBracket"] = 93] = "CloseSquareBracket";
161
+ /**
162
+ * The `^` character.
163
+ */
164
+ CharCode[CharCode["Caret"] = 94] = "Caret";
165
+ /**
166
+ * The `_` character.
167
+ */
168
+ CharCode[CharCode["Underline"] = 95] = "Underline";
169
+ /**
170
+ * The ``(`)`` character.
171
+ */
172
+ CharCode[CharCode["BackTick"] = 96] = "BackTick";
173
+ CharCode[CharCode["a"] = 97] = "a";
174
+ CharCode[CharCode["b"] = 98] = "b";
175
+ CharCode[CharCode["c"] = 99] = "c";
176
+ CharCode[CharCode["d"] = 100] = "d";
177
+ CharCode[CharCode["e"] = 101] = "e";
178
+ CharCode[CharCode["f"] = 102] = "f";
179
+ CharCode[CharCode["g"] = 103] = "g";
180
+ CharCode[CharCode["h"] = 104] = "h";
181
+ CharCode[CharCode["i"] = 105] = "i";
182
+ CharCode[CharCode["j"] = 106] = "j";
183
+ CharCode[CharCode["k"] = 107] = "k";
184
+ CharCode[CharCode["l"] = 108] = "l";
185
+ CharCode[CharCode["m"] = 109] = "m";
186
+ CharCode[CharCode["n"] = 110] = "n";
187
+ CharCode[CharCode["o"] = 111] = "o";
188
+ CharCode[CharCode["p"] = 112] = "p";
189
+ CharCode[CharCode["q"] = 113] = "q";
190
+ CharCode[CharCode["r"] = 114] = "r";
191
+ CharCode[CharCode["s"] = 115] = "s";
192
+ CharCode[CharCode["t"] = 116] = "t";
193
+ CharCode[CharCode["u"] = 117] = "u";
194
+ CharCode[CharCode["v"] = 118] = "v";
195
+ CharCode[CharCode["w"] = 119] = "w";
196
+ CharCode[CharCode["x"] = 120] = "x";
197
+ CharCode[CharCode["y"] = 121] = "y";
198
+ CharCode[CharCode["z"] = 122] = "z";
199
+ /**
200
+ * The `{` character.
201
+ */
202
+ CharCode[CharCode["OpenCurlyBrace"] = 123] = "OpenCurlyBrace";
203
+ /**
204
+ * The `|` character.
205
+ */
206
+ CharCode[CharCode["Pipe"] = 124] = "Pipe";
207
+ /**
208
+ * The `}` character.
209
+ */
210
+ CharCode[CharCode["CloseCurlyBrace"] = 125] = "CloseCurlyBrace";
211
+ /**
212
+ * The `~` character.
213
+ */
214
+ CharCode[CharCode["Tilde"] = 126] = "Tilde";
215
+ CharCode[CharCode["U_Combining_Grave_Accent"] = 768] = "U_Combining_Grave_Accent";
216
+ CharCode[CharCode["U_Combining_Acute_Accent"] = 769] = "U_Combining_Acute_Accent";
217
+ CharCode[CharCode["U_Combining_Circumflex_Accent"] = 770] = "U_Combining_Circumflex_Accent";
218
+ CharCode[CharCode["U_Combining_Tilde"] = 771] = "U_Combining_Tilde";
219
+ CharCode[CharCode["U_Combining_Macron"] = 772] = "U_Combining_Macron";
220
+ CharCode[CharCode["U_Combining_Overline"] = 773] = "U_Combining_Overline";
221
+ CharCode[CharCode["U_Combining_Breve"] = 774] = "U_Combining_Breve";
222
+ CharCode[CharCode["U_Combining_Dot_Above"] = 775] = "U_Combining_Dot_Above";
223
+ CharCode[CharCode["U_Combining_Diaeresis"] = 776] = "U_Combining_Diaeresis";
224
+ CharCode[CharCode["U_Combining_Hook_Above"] = 777] = "U_Combining_Hook_Above";
225
+ CharCode[CharCode["U_Combining_Ring_Above"] = 778] = "U_Combining_Ring_Above";
226
+ CharCode[CharCode["U_Combining_Double_Acute_Accent"] = 779] = "U_Combining_Double_Acute_Accent";
227
+ CharCode[CharCode["U_Combining_Caron"] = 780] = "U_Combining_Caron";
228
+ CharCode[CharCode["U_Combining_Vertical_Line_Above"] = 781] = "U_Combining_Vertical_Line_Above";
229
+ CharCode[CharCode["U_Combining_Double_Vertical_Line_Above"] = 782] = "U_Combining_Double_Vertical_Line_Above";
230
+ CharCode[CharCode["U_Combining_Double_Grave_Accent"] = 783] = "U_Combining_Double_Grave_Accent";
231
+ CharCode[CharCode["U_Combining_Candrabindu"] = 784] = "U_Combining_Candrabindu";
232
+ CharCode[CharCode["U_Combining_Inverted_Breve"] = 785] = "U_Combining_Inverted_Breve";
233
+ CharCode[CharCode["U_Combining_Turned_Comma_Above"] = 786] = "U_Combining_Turned_Comma_Above";
234
+ CharCode[CharCode["U_Combining_Comma_Above"] = 787] = "U_Combining_Comma_Above";
235
+ CharCode[CharCode["U_Combining_Reversed_Comma_Above"] = 788] = "U_Combining_Reversed_Comma_Above";
236
+ CharCode[CharCode["U_Combining_Comma_Above_Right"] = 789] = "U_Combining_Comma_Above_Right";
237
+ CharCode[CharCode["U_Combining_Grave_Accent_Below"] = 790] = "U_Combining_Grave_Accent_Below";
238
+ CharCode[CharCode["U_Combining_Acute_Accent_Below"] = 791] = "U_Combining_Acute_Accent_Below";
239
+ CharCode[CharCode["U_Combining_Left_Tack_Below"] = 792] = "U_Combining_Left_Tack_Below";
240
+ CharCode[CharCode["U_Combining_Right_Tack_Below"] = 793] = "U_Combining_Right_Tack_Below";
241
+ CharCode[CharCode["U_Combining_Left_Angle_Above"] = 794] = "U_Combining_Left_Angle_Above";
242
+ CharCode[CharCode["U_Combining_Horn"] = 795] = "U_Combining_Horn";
243
+ CharCode[CharCode["U_Combining_Left_Half_Ring_Below"] = 796] = "U_Combining_Left_Half_Ring_Below";
244
+ CharCode[CharCode["U_Combining_Up_Tack_Below"] = 797] = "U_Combining_Up_Tack_Below";
245
+ CharCode[CharCode["U_Combining_Down_Tack_Below"] = 798] = "U_Combining_Down_Tack_Below";
246
+ CharCode[CharCode["U_Combining_Plus_Sign_Below"] = 799] = "U_Combining_Plus_Sign_Below";
247
+ CharCode[CharCode["U_Combining_Minus_Sign_Below"] = 800] = "U_Combining_Minus_Sign_Below";
248
+ CharCode[CharCode["U_Combining_Palatalized_Hook_Below"] = 801] = "U_Combining_Palatalized_Hook_Below";
249
+ CharCode[CharCode["U_Combining_Retroflex_Hook_Below"] = 802] = "U_Combining_Retroflex_Hook_Below";
250
+ CharCode[CharCode["U_Combining_Dot_Below"] = 803] = "U_Combining_Dot_Below";
251
+ CharCode[CharCode["U_Combining_Diaeresis_Below"] = 804] = "U_Combining_Diaeresis_Below";
252
+ CharCode[CharCode["U_Combining_Ring_Below"] = 805] = "U_Combining_Ring_Below";
253
+ CharCode[CharCode["U_Combining_Comma_Below"] = 806] = "U_Combining_Comma_Below";
254
+ CharCode[CharCode["U_Combining_Cedilla"] = 807] = "U_Combining_Cedilla";
255
+ CharCode[CharCode["U_Combining_Ogonek"] = 808] = "U_Combining_Ogonek";
256
+ CharCode[CharCode["U_Combining_Vertical_Line_Below"] = 809] = "U_Combining_Vertical_Line_Below";
257
+ CharCode[CharCode["U_Combining_Bridge_Below"] = 810] = "U_Combining_Bridge_Below";
258
+ CharCode[CharCode["U_Combining_Inverted_Double_Arch_Below"] = 811] = "U_Combining_Inverted_Double_Arch_Below";
259
+ CharCode[CharCode["U_Combining_Caron_Below"] = 812] = "U_Combining_Caron_Below";
260
+ CharCode[CharCode["U_Combining_Circumflex_Accent_Below"] = 813] = "U_Combining_Circumflex_Accent_Below";
261
+ CharCode[CharCode["U_Combining_Breve_Below"] = 814] = "U_Combining_Breve_Below";
262
+ CharCode[CharCode["U_Combining_Inverted_Breve_Below"] = 815] = "U_Combining_Inverted_Breve_Below";
263
+ CharCode[CharCode["U_Combining_Tilde_Below"] = 816] = "U_Combining_Tilde_Below";
264
+ CharCode[CharCode["U_Combining_Macron_Below"] = 817] = "U_Combining_Macron_Below";
265
+ CharCode[CharCode["U_Combining_Low_Line"] = 818] = "U_Combining_Low_Line";
266
+ CharCode[CharCode["U_Combining_Double_Low_Line"] = 819] = "U_Combining_Double_Low_Line";
267
+ CharCode[CharCode["U_Combining_Tilde_Overlay"] = 820] = "U_Combining_Tilde_Overlay";
268
+ CharCode[CharCode["U_Combining_Short_Stroke_Overlay"] = 821] = "U_Combining_Short_Stroke_Overlay";
269
+ CharCode[CharCode["U_Combining_Long_Stroke_Overlay"] = 822] = "U_Combining_Long_Stroke_Overlay";
270
+ CharCode[CharCode["U_Combining_Short_Solidus_Overlay"] = 823] = "U_Combining_Short_Solidus_Overlay";
271
+ CharCode[CharCode["U_Combining_Long_Solidus_Overlay"] = 824] = "U_Combining_Long_Solidus_Overlay";
272
+ CharCode[CharCode["U_Combining_Right_Half_Ring_Below"] = 825] = "U_Combining_Right_Half_Ring_Below";
273
+ CharCode[CharCode["U_Combining_Inverted_Bridge_Below"] = 826] = "U_Combining_Inverted_Bridge_Below";
274
+ CharCode[CharCode["U_Combining_Square_Below"] = 827] = "U_Combining_Square_Below";
275
+ CharCode[CharCode["U_Combining_Seagull_Below"] = 828] = "U_Combining_Seagull_Below";
276
+ CharCode[CharCode["U_Combining_X_Above"] = 829] = "U_Combining_X_Above";
277
+ CharCode[CharCode["U_Combining_Vertical_Tilde"] = 830] = "U_Combining_Vertical_Tilde";
278
+ CharCode[CharCode["U_Combining_Double_Overline"] = 831] = "U_Combining_Double_Overline";
279
+ CharCode[CharCode["U_Combining_Grave_Tone_Mark"] = 832] = "U_Combining_Grave_Tone_Mark";
280
+ CharCode[CharCode["U_Combining_Acute_Tone_Mark"] = 833] = "U_Combining_Acute_Tone_Mark";
281
+ CharCode[CharCode["U_Combining_Greek_Perispomeni"] = 834] = "U_Combining_Greek_Perispomeni";
282
+ CharCode[CharCode["U_Combining_Greek_Koronis"] = 835] = "U_Combining_Greek_Koronis";
283
+ CharCode[CharCode["U_Combining_Greek_Dialytika_Tonos"] = 836] = "U_Combining_Greek_Dialytika_Tonos";
284
+ CharCode[CharCode["U_Combining_Greek_Ypogegrammeni"] = 837] = "U_Combining_Greek_Ypogegrammeni";
285
+ CharCode[CharCode["U_Combining_Bridge_Above"] = 838] = "U_Combining_Bridge_Above";
286
+ CharCode[CharCode["U_Combining_Equals_Sign_Below"] = 839] = "U_Combining_Equals_Sign_Below";
287
+ CharCode[CharCode["U_Combining_Double_Vertical_Line_Below"] = 840] = "U_Combining_Double_Vertical_Line_Below";
288
+ CharCode[CharCode["U_Combining_Left_Angle_Below"] = 841] = "U_Combining_Left_Angle_Below";
289
+ CharCode[CharCode["U_Combining_Not_Tilde_Above"] = 842] = "U_Combining_Not_Tilde_Above";
290
+ CharCode[CharCode["U_Combining_Homothetic_Above"] = 843] = "U_Combining_Homothetic_Above";
291
+ CharCode[CharCode["U_Combining_Almost_Equal_To_Above"] = 844] = "U_Combining_Almost_Equal_To_Above";
292
+ CharCode[CharCode["U_Combining_Left_Right_Arrow_Below"] = 845] = "U_Combining_Left_Right_Arrow_Below";
293
+ CharCode[CharCode["U_Combining_Upwards_Arrow_Below"] = 846] = "U_Combining_Upwards_Arrow_Below";
294
+ CharCode[CharCode["U_Combining_Grapheme_Joiner"] = 847] = "U_Combining_Grapheme_Joiner";
295
+ CharCode[CharCode["U_Combining_Right_Arrowhead_Above"] = 848] = "U_Combining_Right_Arrowhead_Above";
296
+ CharCode[CharCode["U_Combining_Left_Half_Ring_Above"] = 849] = "U_Combining_Left_Half_Ring_Above";
297
+ CharCode[CharCode["U_Combining_Fermata"] = 850] = "U_Combining_Fermata";
298
+ CharCode[CharCode["U_Combining_X_Below"] = 851] = "U_Combining_X_Below";
299
+ CharCode[CharCode["U_Combining_Left_Arrowhead_Below"] = 852] = "U_Combining_Left_Arrowhead_Below";
300
+ CharCode[CharCode["U_Combining_Right_Arrowhead_Below"] = 853] = "U_Combining_Right_Arrowhead_Below";
301
+ CharCode[CharCode["U_Combining_Right_Arrowhead_And_Up_Arrowhead_Below"] = 854] = "U_Combining_Right_Arrowhead_And_Up_Arrowhead_Below";
302
+ CharCode[CharCode["U_Combining_Right_Half_Ring_Above"] = 855] = "U_Combining_Right_Half_Ring_Above";
303
+ CharCode[CharCode["U_Combining_Dot_Above_Right"] = 856] = "U_Combining_Dot_Above_Right";
304
+ CharCode[CharCode["U_Combining_Asterisk_Below"] = 857] = "U_Combining_Asterisk_Below";
305
+ CharCode[CharCode["U_Combining_Double_Ring_Below"] = 858] = "U_Combining_Double_Ring_Below";
306
+ CharCode[CharCode["U_Combining_Zigzag_Above"] = 859] = "U_Combining_Zigzag_Above";
307
+ CharCode[CharCode["U_Combining_Double_Breve_Below"] = 860] = "U_Combining_Double_Breve_Below";
308
+ CharCode[CharCode["U_Combining_Double_Breve"] = 861] = "U_Combining_Double_Breve";
309
+ CharCode[CharCode["U_Combining_Double_Macron"] = 862] = "U_Combining_Double_Macron";
310
+ CharCode[CharCode["U_Combining_Double_Macron_Below"] = 863] = "U_Combining_Double_Macron_Below";
311
+ CharCode[CharCode["U_Combining_Double_Tilde"] = 864] = "U_Combining_Double_Tilde";
312
+ CharCode[CharCode["U_Combining_Double_Inverted_Breve"] = 865] = "U_Combining_Double_Inverted_Breve";
313
+ CharCode[CharCode["U_Combining_Double_Rightwards_Arrow_Below"] = 866] = "U_Combining_Double_Rightwards_Arrow_Below";
314
+ CharCode[CharCode["U_Combining_Latin_Small_Letter_A"] = 867] = "U_Combining_Latin_Small_Letter_A";
315
+ CharCode[CharCode["U_Combining_Latin_Small_Letter_E"] = 868] = "U_Combining_Latin_Small_Letter_E";
316
+ CharCode[CharCode["U_Combining_Latin_Small_Letter_I"] = 869] = "U_Combining_Latin_Small_Letter_I";
317
+ CharCode[CharCode["U_Combining_Latin_Small_Letter_O"] = 870] = "U_Combining_Latin_Small_Letter_O";
318
+ CharCode[CharCode["U_Combining_Latin_Small_Letter_U"] = 871] = "U_Combining_Latin_Small_Letter_U";
319
+ CharCode[CharCode["U_Combining_Latin_Small_Letter_C"] = 872] = "U_Combining_Latin_Small_Letter_C";
320
+ CharCode[CharCode["U_Combining_Latin_Small_Letter_D"] = 873] = "U_Combining_Latin_Small_Letter_D";
321
+ CharCode[CharCode["U_Combining_Latin_Small_Letter_H"] = 874] = "U_Combining_Latin_Small_Letter_H";
322
+ CharCode[CharCode["U_Combining_Latin_Small_Letter_M"] = 875] = "U_Combining_Latin_Small_Letter_M";
323
+ CharCode[CharCode["U_Combining_Latin_Small_Letter_R"] = 876] = "U_Combining_Latin_Small_Letter_R";
324
+ CharCode[CharCode["U_Combining_Latin_Small_Letter_T"] = 877] = "U_Combining_Latin_Small_Letter_T";
325
+ CharCode[CharCode["U_Combining_Latin_Small_Letter_V"] = 878] = "U_Combining_Latin_Small_Letter_V";
326
+ CharCode[CharCode["U_Combining_Latin_Small_Letter_X"] = 879] = "U_Combining_Latin_Small_Letter_X";
327
+ /**
328
+ * Unicode Character 'LINE SEPARATOR' (U+2028)
329
+ * http://www.fileformat.info/info/unicode/char/2028/index.htm
330
+ */
331
+ CharCode[CharCode["LINE_SEPARATOR"] = 8232] = "LINE_SEPARATOR";
332
+ /**
333
+ * Unicode Character 'PARAGRAPH SEPARATOR' (U+2029)
334
+ * http://www.fileformat.info/info/unicode/char/2029/index.htm
335
+ */
336
+ CharCode[CharCode["PARAGRAPH_SEPARATOR"] = 8233] = "PARAGRAPH_SEPARATOR";
337
+ /**
338
+ * Unicode Character 'NEXT LINE' (U+0085)
339
+ * http://www.fileformat.info/info/unicode/char/0085/index.htm
340
+ */
341
+ CharCode[CharCode["NEXT_LINE"] = 133] = "NEXT_LINE";
342
+ // http://www.fileformat.info/info/unicode/category/Sk/list.htm
343
+ CharCode[CharCode["U_CIRCUMFLEX"] = 94] = "U_CIRCUMFLEX";
344
+ CharCode[CharCode["U_GRAVE_ACCENT"] = 96] = "U_GRAVE_ACCENT";
345
+ CharCode[CharCode["U_DIAERESIS"] = 168] = "U_DIAERESIS";
346
+ CharCode[CharCode["U_MACRON"] = 175] = "U_MACRON";
347
+ CharCode[CharCode["U_ACUTE_ACCENT"] = 180] = "U_ACUTE_ACCENT";
348
+ CharCode[CharCode["U_CEDILLA"] = 184] = "U_CEDILLA";
349
+ CharCode[CharCode["U_MODIFIER_LETTER_LEFT_ARROWHEAD"] = 706] = "U_MODIFIER_LETTER_LEFT_ARROWHEAD";
350
+ CharCode[CharCode["U_MODIFIER_LETTER_RIGHT_ARROWHEAD"] = 707] = "U_MODIFIER_LETTER_RIGHT_ARROWHEAD";
351
+ CharCode[CharCode["U_MODIFIER_LETTER_UP_ARROWHEAD"] = 708] = "U_MODIFIER_LETTER_UP_ARROWHEAD";
352
+ CharCode[CharCode["U_MODIFIER_LETTER_DOWN_ARROWHEAD"] = 709] = "U_MODIFIER_LETTER_DOWN_ARROWHEAD";
353
+ CharCode[CharCode["U_MODIFIER_LETTER_CENTRED_RIGHT_HALF_RING"] = 722] = "U_MODIFIER_LETTER_CENTRED_RIGHT_HALF_RING";
354
+ CharCode[CharCode["U_MODIFIER_LETTER_CENTRED_LEFT_HALF_RING"] = 723] = "U_MODIFIER_LETTER_CENTRED_LEFT_HALF_RING";
355
+ CharCode[CharCode["U_MODIFIER_LETTER_UP_TACK"] = 724] = "U_MODIFIER_LETTER_UP_TACK";
356
+ CharCode[CharCode["U_MODIFIER_LETTER_DOWN_TACK"] = 725] = "U_MODIFIER_LETTER_DOWN_TACK";
357
+ CharCode[CharCode["U_MODIFIER_LETTER_PLUS_SIGN"] = 726] = "U_MODIFIER_LETTER_PLUS_SIGN";
358
+ CharCode[CharCode["U_MODIFIER_LETTER_MINUS_SIGN"] = 727] = "U_MODIFIER_LETTER_MINUS_SIGN";
359
+ CharCode[CharCode["U_BREVE"] = 728] = "U_BREVE";
360
+ CharCode[CharCode["U_DOT_ABOVE"] = 729] = "U_DOT_ABOVE";
361
+ CharCode[CharCode["U_RING_ABOVE"] = 730] = "U_RING_ABOVE";
362
+ CharCode[CharCode["U_OGONEK"] = 731] = "U_OGONEK";
363
+ CharCode[CharCode["U_SMALL_TILDE"] = 732] = "U_SMALL_TILDE";
364
+ CharCode[CharCode["U_DOUBLE_ACUTE_ACCENT"] = 733] = "U_DOUBLE_ACUTE_ACCENT";
365
+ CharCode[CharCode["U_MODIFIER_LETTER_RHOTIC_HOOK"] = 734] = "U_MODIFIER_LETTER_RHOTIC_HOOK";
366
+ CharCode[CharCode["U_MODIFIER_LETTER_CROSS_ACCENT"] = 735] = "U_MODIFIER_LETTER_CROSS_ACCENT";
367
+ CharCode[CharCode["U_MODIFIER_LETTER_EXTRA_HIGH_TONE_BAR"] = 741] = "U_MODIFIER_LETTER_EXTRA_HIGH_TONE_BAR";
368
+ CharCode[CharCode["U_MODIFIER_LETTER_HIGH_TONE_BAR"] = 742] = "U_MODIFIER_LETTER_HIGH_TONE_BAR";
369
+ CharCode[CharCode["U_MODIFIER_LETTER_MID_TONE_BAR"] = 743] = "U_MODIFIER_LETTER_MID_TONE_BAR";
370
+ CharCode[CharCode["U_MODIFIER_LETTER_LOW_TONE_BAR"] = 744] = "U_MODIFIER_LETTER_LOW_TONE_BAR";
371
+ CharCode[CharCode["U_MODIFIER_LETTER_EXTRA_LOW_TONE_BAR"] = 745] = "U_MODIFIER_LETTER_EXTRA_LOW_TONE_BAR";
372
+ CharCode[CharCode["U_MODIFIER_LETTER_YIN_DEPARTING_TONE_MARK"] = 746] = "U_MODIFIER_LETTER_YIN_DEPARTING_TONE_MARK";
373
+ CharCode[CharCode["U_MODIFIER_LETTER_YANG_DEPARTING_TONE_MARK"] = 747] = "U_MODIFIER_LETTER_YANG_DEPARTING_TONE_MARK";
374
+ CharCode[CharCode["U_MODIFIER_LETTER_UNASPIRATED"] = 749] = "U_MODIFIER_LETTER_UNASPIRATED";
375
+ CharCode[CharCode["U_MODIFIER_LETTER_LOW_DOWN_ARROWHEAD"] = 751] = "U_MODIFIER_LETTER_LOW_DOWN_ARROWHEAD";
376
+ CharCode[CharCode["U_MODIFIER_LETTER_LOW_UP_ARROWHEAD"] = 752] = "U_MODIFIER_LETTER_LOW_UP_ARROWHEAD";
377
+ CharCode[CharCode["U_MODIFIER_LETTER_LOW_LEFT_ARROWHEAD"] = 753] = "U_MODIFIER_LETTER_LOW_LEFT_ARROWHEAD";
378
+ CharCode[CharCode["U_MODIFIER_LETTER_LOW_RIGHT_ARROWHEAD"] = 754] = "U_MODIFIER_LETTER_LOW_RIGHT_ARROWHEAD";
379
+ CharCode[CharCode["U_MODIFIER_LETTER_LOW_RING"] = 755] = "U_MODIFIER_LETTER_LOW_RING";
380
+ CharCode[CharCode["U_MODIFIER_LETTER_MIDDLE_GRAVE_ACCENT"] = 756] = "U_MODIFIER_LETTER_MIDDLE_GRAVE_ACCENT";
381
+ CharCode[CharCode["U_MODIFIER_LETTER_MIDDLE_DOUBLE_GRAVE_ACCENT"] = 757] = "U_MODIFIER_LETTER_MIDDLE_DOUBLE_GRAVE_ACCENT";
382
+ CharCode[CharCode["U_MODIFIER_LETTER_MIDDLE_DOUBLE_ACUTE_ACCENT"] = 758] = "U_MODIFIER_LETTER_MIDDLE_DOUBLE_ACUTE_ACCENT";
383
+ CharCode[CharCode["U_MODIFIER_LETTER_LOW_TILDE"] = 759] = "U_MODIFIER_LETTER_LOW_TILDE";
384
+ CharCode[CharCode["U_MODIFIER_LETTER_RAISED_COLON"] = 760] = "U_MODIFIER_LETTER_RAISED_COLON";
385
+ CharCode[CharCode["U_MODIFIER_LETTER_BEGIN_HIGH_TONE"] = 761] = "U_MODIFIER_LETTER_BEGIN_HIGH_TONE";
386
+ CharCode[CharCode["U_MODIFIER_LETTER_END_HIGH_TONE"] = 762] = "U_MODIFIER_LETTER_END_HIGH_TONE";
387
+ CharCode[CharCode["U_MODIFIER_LETTER_BEGIN_LOW_TONE"] = 763] = "U_MODIFIER_LETTER_BEGIN_LOW_TONE";
388
+ CharCode[CharCode["U_MODIFIER_LETTER_END_LOW_TONE"] = 764] = "U_MODIFIER_LETTER_END_LOW_TONE";
389
+ CharCode[CharCode["U_MODIFIER_LETTER_SHELF"] = 765] = "U_MODIFIER_LETTER_SHELF";
390
+ CharCode[CharCode["U_MODIFIER_LETTER_OPEN_SHELF"] = 766] = "U_MODIFIER_LETTER_OPEN_SHELF";
391
+ CharCode[CharCode["U_MODIFIER_LETTER_LOW_LEFT_ARROW"] = 767] = "U_MODIFIER_LETTER_LOW_LEFT_ARROW";
392
+ CharCode[CharCode["U_GREEK_LOWER_NUMERAL_SIGN"] = 885] = "U_GREEK_LOWER_NUMERAL_SIGN";
393
+ CharCode[CharCode["U_GREEK_TONOS"] = 900] = "U_GREEK_TONOS";
394
+ CharCode[CharCode["U_GREEK_DIALYTIKA_TONOS"] = 901] = "U_GREEK_DIALYTIKA_TONOS";
395
+ CharCode[CharCode["U_GREEK_KORONIS"] = 8125] = "U_GREEK_KORONIS";
396
+ CharCode[CharCode["U_GREEK_PSILI"] = 8127] = "U_GREEK_PSILI";
397
+ CharCode[CharCode["U_GREEK_PERISPOMENI"] = 8128] = "U_GREEK_PERISPOMENI";
398
+ CharCode[CharCode["U_GREEK_DIALYTIKA_AND_PERISPOMENI"] = 8129] = "U_GREEK_DIALYTIKA_AND_PERISPOMENI";
399
+ CharCode[CharCode["U_GREEK_PSILI_AND_VARIA"] = 8141] = "U_GREEK_PSILI_AND_VARIA";
400
+ CharCode[CharCode["U_GREEK_PSILI_AND_OXIA"] = 8142] = "U_GREEK_PSILI_AND_OXIA";
401
+ CharCode[CharCode["U_GREEK_PSILI_AND_PERISPOMENI"] = 8143] = "U_GREEK_PSILI_AND_PERISPOMENI";
402
+ CharCode[CharCode["U_GREEK_DASIA_AND_VARIA"] = 8157] = "U_GREEK_DASIA_AND_VARIA";
403
+ CharCode[CharCode["U_GREEK_DASIA_AND_OXIA"] = 8158] = "U_GREEK_DASIA_AND_OXIA";
404
+ CharCode[CharCode["U_GREEK_DASIA_AND_PERISPOMENI"] = 8159] = "U_GREEK_DASIA_AND_PERISPOMENI";
405
+ CharCode[CharCode["U_GREEK_DIALYTIKA_AND_VARIA"] = 8173] = "U_GREEK_DIALYTIKA_AND_VARIA";
406
+ CharCode[CharCode["U_GREEK_DIALYTIKA_AND_OXIA"] = 8174] = "U_GREEK_DIALYTIKA_AND_OXIA";
407
+ CharCode[CharCode["U_GREEK_VARIA"] = 8175] = "U_GREEK_VARIA";
408
+ CharCode[CharCode["U_GREEK_OXIA"] = 8189] = "U_GREEK_OXIA";
409
+ CharCode[CharCode["U_GREEK_DASIA"] = 8190] = "U_GREEK_DASIA";
410
+ CharCode[CharCode["U_IDEOGRAPHIC_FULL_STOP"] = 12290] = "U_IDEOGRAPHIC_FULL_STOP";
411
+ CharCode[CharCode["U_LEFT_CORNER_BRACKET"] = 12300] = "U_LEFT_CORNER_BRACKET";
412
+ CharCode[CharCode["U_RIGHT_CORNER_BRACKET"] = 12301] = "U_RIGHT_CORNER_BRACKET";
413
+ CharCode[CharCode["U_LEFT_BLACK_LENTICULAR_BRACKET"] = 12304] = "U_LEFT_BLACK_LENTICULAR_BRACKET";
414
+ CharCode[CharCode["U_RIGHT_BLACK_LENTICULAR_BRACKET"] = 12305] = "U_RIGHT_BLACK_LENTICULAR_BRACKET";
415
+ CharCode[CharCode["U_OVERLINE"] = 8254] = "U_OVERLINE";
416
+ /**
417
+ * UTF-8 BOM
418
+ * Unicode Character 'ZERO WIDTH NO-BREAK SPACE' (U+FEFF)
419
+ * http://www.fileformat.info/info/unicode/char/feff/index.htm
420
+ */
421
+ CharCode[CharCode["UTF8_BOM"] = 65279] = "UTF8_BOM";
422
+ CharCode[CharCode["U_FULLWIDTH_SEMICOLON"] = 65307] = "U_FULLWIDTH_SEMICOLON";
423
+ CharCode[CharCode["U_FULLWIDTH_COMMA"] = 65292] = "U_FULLWIDTH_COMMA";
424
+ })(CharCode || (CharCode = {}));
@@ -0,0 +1,4 @@
1
+ export declare function commonSuffix(a: string, b: string): string;
2
+ export declare function commonSuffixLength(a: string, b: string): number;
3
+ export declare function commonPrefix(a: string, b: string): string;
4
+ export declare function commonPrefixLength(a: string, b: string): number;
@@ -0,0 +1,28 @@
1
+ export function commonSuffix(a, b) {
2
+ const strs = [];
3
+ const aLastIndex = a.length - 1;
4
+ const bLastIndex = b.length - 1;
5
+ const len = Math.min(a.length, b.length);
6
+ for (let i = 0; i < len; i += 1) {
7
+ if (a.charCodeAt(aLastIndex - i) !== b.charCodeAt(bLastIndex - i))
8
+ break;
9
+ strs.push(a[i]);
10
+ }
11
+ return strs.join('');
12
+ }
13
+ export function commonSuffixLength(a, b) {
14
+ return commonSuffix(a, b).length;
15
+ }
16
+ export function commonPrefix(a, b) {
17
+ const strs = [];
18
+ const len = Math.min(a.length, b.length);
19
+ for (let i = 0; i < len; i += 1) {
20
+ if (a.charCodeAt(i) !== b.charCodeAt(i))
21
+ break;
22
+ strs.push(a[i]);
23
+ }
24
+ return strs.join('');
25
+ }
26
+ export function commonPrefixLength(a, b) {
27
+ return commonPrefix(a, b).length;
28
+ }
@@ -0,0 +1,4 @@
1
+ export declare function containsEmoji(str: string): boolean;
2
+ export declare function isBasicASCII(str: string): boolean;
3
+ export declare function containsFullWidthCharactor(str: string): boolean;
4
+ export declare function isFullWidthCharacter(charCode: number): boolean;
@@ -0,0 +1,60 @@
1
+ // Generated using https://github.com/alexdima/unicode-utils/blob/master/generate-emoji-test.js
2
+ const CONTAINS_EMOJI = /(?:[\u231A\u231B\u23F0\u23F3\u2600-\u27BF\u2B50\u2B55]|\uD83C[\uDDE6-\uDDFF\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F\uDE80-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD00-\uDDFF\uDE70-\uDED6])/;
3
+ export function containsEmoji(str) {
4
+ return CONTAINS_EMOJI.test(str);
5
+ }
6
+ const BASIC_ASCII = /^[\t\n\r\x20-\x7E]*$/;
7
+ // tslint:disable-next-line: naming-convention
8
+ export function isBasicASCII(str) {
9
+ return BASIC_ASCII.test(str);
10
+ }
11
+ export function containsFullWidthCharactor(str) {
12
+ for (let i = 0, len = str.length; i < len; i += 1)
13
+ if (isFullWidthCharacter(str.charCodeAt(i)))
14
+ return true;
15
+ return false;
16
+ }
17
+ export function isFullWidthCharacter(charCode) {
18
+ // Do a cheap trick to better support wrapping of wide characters, treat them as 2 columns
19
+ // http://jrgraphix.net/research/unicode_blocks.php
20
+ // 2E80 — 2EFF CJK Radicals Supplement
21
+ // 2F00 — 2FDF Kangxi Radicals
22
+ // 2FF0 — 2FFF Ideographic Description Characters
23
+ // 3000 — 303F CJK Symbols and Punctuation
24
+ // 3040 — 309F Hiragana
25
+ // 30A0 — 30FF Katakana
26
+ // 3100 — 312F Bopomofo
27
+ // 3130 — 318F Hangul Compatibility Jamo
28
+ // 3190 — 319F Kanbun
29
+ // 31A0 — 31BF Bopomofo Extended
30
+ // 31F0 — 31FF Katakana Phonetic Extensions
31
+ // 3200 — 32FF Enclosed CJK Letters and Months
32
+ // 3300 — 33FF CJK Compatibility
33
+ // 3400 — 4DBF CJK Unified Ideographs Extension A
34
+ // 4DC0 — 4DFF Yijing Hexagram Symbols
35
+ // 4E00 — 9FFF CJK Unified Ideographs
36
+ // A000 — A48F Yi Syllables
37
+ // A490 — A4CF Yi Radicals
38
+ // AC00 — D7AF Hangul Syllables
39
+ // [IGNORE] D800 — DB7F High Surrogates
40
+ // [IGNORE] DB80 — DBFF High Private Use Surrogates
41
+ // [IGNORE] DC00 — DFFF Low Surrogates
42
+ // [IGNORE] E000 — F8FF Private Use Area
43
+ // F900 — FAFF CJK Compatibility Ideographs
44
+ // [IGNORE] FB00 — FB4F Alphabetic Presentation Forms
45
+ // [IGNORE] FB50 — FDFF Arabic Presentation Forms-A
46
+ // [IGNORE] FE00 — FE0F Variation Selectors
47
+ // [IGNORE] FE20 — FE2F Combining Half Marks
48
+ // [IGNORE] FE30 — FE4F CJK Compatibility Forms
49
+ // [IGNORE] FE50 — FE6F Small Form Variants
50
+ // [IGNORE] FE70 — FEFF Arabic Presentation Forms-B
51
+ // FF00 — FFEF Halfwidth and Fullwidth Forms
52
+ // [https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms]
53
+ // of which FF01 - FF5E fullwidth ASCII of 21 to 7E
54
+ // [IGNORE] and FF65 - FFDC halfwidth of Katakana and Hangul
55
+ // [IGNORE] FFF0 — FFFF Specials
56
+ charCode = +charCode; // @perf
57
+ return ((charCode >= 0x2e80 && charCode <= 0xd7af) ||
58
+ (charCode >= 0xf900 && charCode <= 0xfaff) ||
59
+ (charCode >= 0xff01 && charCode <= 0xff5e));
60
+ }
@@ -0,0 +1,5 @@
1
+ export * from './contain.js';
2
+ export * from './surrogate.js';
3
+ export * from './char-code.js';
4
+ export * from './judges.js';
5
+ export * from './case.js';
@@ -0,0 +1,5 @@
1
+ export * from './contain.js';
2
+ export * from './surrogate.js';
3
+ export * from './char-code.js';
4
+ export * from './judges.js';
5
+ export * from './case.js';
@@ -0,0 +1,3 @@
1
+ export declare function isWhitespaceAtPos(value: string, index: number): boolean;
2
+ export declare function isSeparatorAtPos(value: string, index: number): boolean;
3
+ export declare function isUpperCaseAtPos(value: string, pos: number): boolean;
@@ -0,0 +1,38 @@
1
+ import { CharCode } from './char-code.js';
2
+ export function isWhitespaceAtPos(value, index) {
3
+ if (index < 0 || index >= value.length)
4
+ return false;
5
+ const code = value.charCodeAt(index);
6
+ return code === CharCode.Space || code === CharCode.Tab;
7
+ }
8
+ export function isSeparatorAtPos(value, index) {
9
+ if (index < -1 || index >= value.length)
10
+ return false;
11
+ const code = value.codePointAt(index);
12
+ switch (code) {
13
+ case CharCode.Underline:
14
+ case CharCode.Dash:
15
+ case CharCode.Period:
16
+ case CharCode.Space:
17
+ case CharCode.Slash:
18
+ case CharCode.Backslash:
19
+ case CharCode.SingleQuote:
20
+ case CharCode.DoubleQuote:
21
+ case CharCode.Colon:
22
+ case CharCode.DollarSign:
23
+ case CharCode.LessThan:
24
+ case CharCode.OpenParen:
25
+ case CharCode.OpenSquareBracket:
26
+ return true;
27
+ case undefined:
28
+ return false;
29
+ default:
30
+ // if (strings.isEmojiImprecise(code)) {
31
+ // return true;
32
+ // }
33
+ return false;
34
+ }
35
+ }
36
+ export function isUpperCaseAtPos(value, pos) {
37
+ return value[pos] !== value.toLocaleLowerCase()[pos];
38
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * See http://en.wikipedia.org/wiki/Surrogate_pair
3
+ */
4
+ export declare function isHighSurrogate(charCode: number): boolean;
5
+ /**
6
+ * See http://en.wikipedia.org/wiki/Surrogate_pair
7
+ */
8
+ export declare function isLowSurrogate(charCode: number): boolean;
9
+ /**
10
+ * See http://en.wikipedia.org/wiki/Surrogate_pair
11
+ */
12
+ export declare function computeCodePoint(highSurrogate: number, lowSurrogate: number): number;
13
+ /**
14
+ * get the code point that begins at offset `offset`
15
+ */
16
+ export declare function getNextCodePoint(str: string, len: number, offset: number): number;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * See http://en.wikipedia.org/wiki/Surrogate_pair
3
+ */
4
+ export function isHighSurrogate(charCode) {
5
+ return 0xd800 <= charCode && charCode <= 0xdbff;
6
+ }
7
+ /**
8
+ * See http://en.wikipedia.org/wiki/Surrogate_pair
9
+ */
10
+ export function isLowSurrogate(charCode) {
11
+ return 0xdc00 <= charCode && charCode <= 0xdfff;
12
+ }
13
+ /**
14
+ * See http://en.wikipedia.org/wiki/Surrogate_pair
15
+ */
16
+ export function computeCodePoint(highSurrogate, lowSurrogate) {
17
+ return ((highSurrogate - 0xd800) << 10) + (lowSurrogate - 0xdc00) + 0x10000;
18
+ }
19
+ /**
20
+ * get the code point that begins at offset `offset`
21
+ */
22
+ export function getNextCodePoint(str, len, offset) {
23
+ const charCode = str.charCodeAt(offset);
24
+ if (isHighSurrogate(charCode) && offset + 1 < len) {
25
+ const nextCharCode = str.charCodeAt(offset + 1);
26
+ if (isLowSurrogate(nextCharCode))
27
+ return computeCodePoint(charCode, nextCharCode);
28
+ }
29
+ return charCode;
30
+ }