- exclude custom placeholder content if there was no match

This commit is contained in:
Mike Penz
2022-07-30 08:15:32 +02:00
parent d498bbd476
commit 2f418c46e5
3 changed files with 13 additions and 9 deletions
Generated Vendored
+7 -5
View File
File diff suppressed because one or more lines are too long
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+5 -3
View File
@@ -337,10 +337,12 @@ function replacePlaceholders(
if (transformer?.pattern) {
const extractedValue = value.replace(transformer.pattern, transformer.target)
// note: `.replace` will return the full string again if there was no match
if (extractedValue && placeholderPrMap && extractedValue !== value) {
createOrSet(placeholderPrMap, placeholder.name, extractedValue)
if (extractedValue && extractedValue !== value) {
if (placeholderPrMap) {
createOrSet(placeholderPrMap, placeholder.name, extractedValue)
}
transformed = transformed.replaceAll(`\${{${placeholder.name}}}`, extractedValue)
}
transformed = transformed.replaceAll(`\${{${placeholder.name}}}`, extractedValue)
}
}
}