@amritk/helpers
Advanced tools
@@ -67,2 +67,10 @@ /** | ||
| }); | ||
| // The empty pattern is valid JSON Schema (it matches everything), but an empty | ||
| // regex body would emit `//` \u2014 a line comment, not a literal \u2014 and break the | ||
| // generated file. Emit `(?:)` instead, exactly what `new RegExp('').source` | ||
| // yields: an empty non-capturing group that still matches everything. | ||
| if (escaped === '') { | ||
| escapeCache.set(pattern, '(?:)'); | ||
| return '(?:)'; | ||
| } | ||
| if (escapeCache.size >= ESCAPE_CACHE_LIMIT) { | ||
@@ -69,0 +77,0 @@ // Evict the single oldest entry (Maps iterate in insertion order) instead |
+1
-1
| { | ||
| "name": "@amritk/helpers", | ||
| "version": "0.13.0", | ||
| "version": "0.13.1", | ||
| "description": "Shared utilities for the mjst code generation ecosystem.", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -70,2 +70,11 @@ /** | ||
| // The empty pattern is valid JSON Schema (it matches everything), but an empty | ||
| // regex body would emit `//` \u2014 a line comment, not a literal \u2014 and break the | ||
| // generated file. Emit `(?:)` instead, exactly what `new RegExp('').source` | ||
| // yields: an empty non-capturing group that still matches everything. | ||
| if (escaped === '') { | ||
| escapeCache.set(pattern, '(?:)') | ||
| return '(?:)' | ||
| } | ||
| if (escapeCache.size >= ESCAPE_CACHE_LIMIT) { | ||
@@ -72,0 +81,0 @@ // Evict the single oldest entry (Maps iterate in insertion order) instead |
230119
0.37%4978
0.32%