@bbn/bbn 2.0.44 → 2.0.45
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/bbn.js +1 -1
- package/dist/bbn.js.map +1 -1
- package/dist/dt/functions/buildLocaleFromIntl.js +13 -1
- package/package.json +1 -1
|
@@ -91,10 +91,22 @@ function partsToPattern(parts, resolved, requestedOpts) {
|
|
|
91
91
|
pattern += 'z';
|
|
92
92
|
break;
|
|
93
93
|
case 'literal': {
|
|
94
|
-
if (p.value
|
|
94
|
+
if (!p.value) {
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
// If the literal contains any letter (ASCII or basic Latin-1),
|
|
98
|
+
// wrap it in [ ... ] so it can't be confused with tokens.
|
|
99
|
+
// Otherwise (spaces, /, -, :, commas, etc.) keep it raw.
|
|
100
|
+
const hasLetter = /[A-Za-zÀ-ÖØ-öø-ÿ]/.test(p.value);
|
|
101
|
+
if (hasLetter) {
|
|
102
|
+
// Escape ']' inside the bracketed literal
|
|
95
103
|
const v = p.value.replace(/]/g, '\\]');
|
|
96
104
|
pattern += `[${v}]`;
|
|
97
105
|
}
|
|
106
|
+
else {
|
|
107
|
+
// Non-problematic punctuation/whitespace: just append as-is
|
|
108
|
+
pattern += p.value;
|
|
109
|
+
}
|
|
98
110
|
break;
|
|
99
111
|
}
|
|
100
112
|
default:
|