mirror of
https://github.com/mshick/add-pr-comment.git
synced 2025-12-31 14:20:32 +11:00
clean up
This commit is contained in:
parent
ff82b38f95
commit
445c144052
1 changed files with 2 additions and 5 deletions
|
|
@ -100,17 +100,14 @@ function splitFind(find: string) {
|
||||||
|
|
||||||
export function findAndReplaceInMessage(
|
export function findAndReplaceInMessage(
|
||||||
find: string[],
|
find: string[],
|
||||||
replacement: string[],
|
replace: string[],
|
||||||
original: string,
|
original: string,
|
||||||
): string {
|
): string {
|
||||||
let message = original
|
let message = original
|
||||||
|
|
||||||
for (const [i, f] of find.entries()) {
|
for (const [i, f] of find.entries()) {
|
||||||
const { regExp, modifiers } = splitFind(f)
|
const { regExp, modifiers } = splitFind(f)
|
||||||
message = message.replace(
|
message = message.replace(new RegExp(regExp, modifiers), replace[i] ?? replace.join('\n'))
|
||||||
new RegExp(regExp, modifiers),
|
|
||||||
replacement[i] ?? replacement.join('\n'),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return message
|
return message
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue