@ibm-cloud/cd-tools 1.15.0 → 1.15.1
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/cmd/utils/utils.js +5 -1
- package/package.json +1 -1
package/cmd/utils/utils.js
CHANGED
|
@@ -206,12 +206,16 @@ export function getRandChars(size) {
|
|
|
206
206
|
};
|
|
207
207
|
|
|
208
208
|
export function normalizeName(str) {
|
|
209
|
-
const specialChars =
|
|
209
|
+
const specialChars = `-–—<>()*#{}[]|@_ .%'",&`; // turn these special chars into underscores
|
|
210
|
+
const whitelistRegex = /[^_\-\p{L}0-9]+/ug // this regex matches anything that is not (unicode, numbers, underscores, and hyphens)
|
|
211
|
+
|
|
210
212
|
let newStr = str;
|
|
211
213
|
|
|
212
214
|
for (const char of specialChars) {
|
|
213
215
|
newStr = newStr.replaceAll(char, '_');
|
|
214
216
|
}
|
|
215
217
|
|
|
218
|
+
newStr = newStr.replaceAll(whitelistRegex, '');
|
|
219
|
+
|
|
216
220
|
return newStr.toLowerCase();
|
|
217
221
|
};
|