Skip to content

Commit

Permalink
Merge pull request mikepenz#933 from mikepenz/feature/929
Browse files Browse the repository at this point in the history
Differentiate between no match vs equal content for transformers
  • Loading branch information
mikepenz committed Oct 27, 2022
2 parents b1d2450 + 6d479c1 commit d77f101
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,10 @@ 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 && extractedValue !== value) {
if (
extractedValue &&
(extractedValue !== value || (extractedValue === value && value.match(transformer.pattern)))
) {
if (placeholderPrMap) {
createOrSet(placeholderPrMap, placeholder.name, extractedValue)
}
Expand Down

0 comments on commit d77f101

Please sign in to comment.