@isopodlabs/utilities 1.5.4 → 1.5.6

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.
package/dist/string.js CHANGED
@@ -17,10 +17,6 @@ exports.splitEvery = splitEvery;
17
17
  exports.tag = tag;
18
18
  exports.previousChar = previousChar;
19
19
  exports.hasCustomToString = hasCustomToString;
20
- exports.parseGlob = parseGlob;
21
- exports.anchoredRe = anchoredRe;
22
- exports.globToRe = globToRe;
23
- exports.globToReMulti = globToReMulti;
24
20
  function firstOf(value, find) {
25
21
  let index = value.length;
26
22
  for (const c of find) {
@@ -165,106 +161,3 @@ class StringParser {
165
161
  }
166
162
  }
167
163
  exports.StringParser = StringParser;
168
- const posixClasses = {
169
- alnum: '\\p{L}\\p{Nl}\\p{Nd}',
170
- alpha: '\\p{L}\\p{Nl}',
171
- ascii: '\\x00-\\x7f',
172
- blank: '\\p{Zs}\\t',
173
- cntrl: '\\p{Cc}',
174
- digit: '\\p{Nd}',
175
- graph: '^\\p{Z}\\p{C}',
176
- lower: '\\p{Ll}',
177
- print: '\\p{C}',
178
- punct: '\\p{P}',
179
- space: '\\p{Z}\\t\\r\\n\\v\\f',
180
- upper: '\\p{Lu}',
181
- word: '\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}',
182
- xdigit: 'A-Fa-f0-9',
183
- };
184
- function parseGlob(glob) {
185
- let result = '';
186
- let depth = 0;
187
- for (let i = 0; i < glob.length; ++i) {
188
- let c = glob[i];
189
- switch (c) {
190
- case '\\':
191
- c = glob[++i];
192
- if ('*?+.,^$()|[]a-zA-Z'.includes(c))
193
- result += '\\';
194
- break;
195
- case '*':
196
- if (glob[i + 1] === '*') {
197
- result += '.*';
198
- ++i;
199
- }
200
- else {
201
- result += '[^/]*';
202
- }
203
- continue;
204
- case '?':
205
- c = '.';
206
- break;
207
- case '+':
208
- case '.':
209
- case '^':
210
- case '$':
211
- case '(':
212
- case ')':
213
- case '|':
214
- result += `\\`;
215
- break;
216
- case '[': {
217
- const end = glob.indexOf(']', i + 1);
218
- if (end > i) {
219
- const next = glob[i + 1];
220
- if (next === ':' && glob[end - 1] === ':') {
221
- const p = posixClasses[glob.slice(i + 2, end - 1)];
222
- if (p) {
223
- result += `[${p}]`;
224
- i = end;
225
- continue;
226
- }
227
- else {
228
- console.log(`Warning: Unknown POSIX class ${glob.slice(i + 2, end - 1)} in glob pattern ${glob}`);
229
- }
230
- }
231
- const neg = next === '!' || next === '^';
232
- result += `[${neg ? '^' : ''}${glob.slice(neg ? i + 2 : i + 1, end)}]`;
233
- i = end;
234
- continue;
235
- }
236
- result += '\\';
237
- break;
238
- }
239
- case '{':
240
- ++depth;
241
- c = '(';
242
- break;
243
- case '}':
244
- if (depth > 0) {
245
- --depth;
246
- c = ')';
247
- }
248
- break;
249
- case ',':
250
- if (depth > 0)
251
- c = '|';
252
- break;
253
- }
254
- result += c;
255
- }
256
- if (depth > 0) {
257
- console.log(`Warning: Unmatched { in glob pattern ${glob}`);
258
- result += ')'.repeat(depth);
259
- }
260
- return result;
261
- }
262
- function anchoredRe(re) {
263
- return new RegExp(`^${re}$`);
264
- }
265
- function globToRe(glob) {
266
- return anchoredRe(parseGlob(glob));
267
- }
268
- function globToReMulti(globs) {
269
- return anchoredRe(globs.map(parseGlob).join('|'));
270
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isopodlabs/utilities",
3
- "version": "1.5.4",
3
+ "version": "1.5.6",
4
4
  "description": "Various typescript helpers.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,8 +16,7 @@
16
16
  "README.md"
17
17
  ],
18
18
  "scripts": {
19
- "build": "tsc",
20
- "test": "echo \"No tests specified\" && exit 0"
19
+ "build": "tsc"
21
20
  },
22
21
  "keywords": [
23
22
  "typescript",