mirror of
https://github.com/mshick/add-pr-comment.git
synced 2025-12-30 22:09:52 +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(
|
||||
find: string[],
|
||||
replacement: string[],
|
||||
replace: string[],
|
||||
original: string,
|
||||
): string {
|
||||
let message = original
|
||||
|
||||
for (const [i, f] of find.entries()) {
|
||||
const { regExp, modifiers } = splitFind(f)
|
||||
message = message.replace(
|
||||
new RegExp(regExp, modifiers),
|
||||
replacement[i] ?? replacement.join('\n'),
|
||||
)
|
||||
message = message.replace(new RegExp(regExp, modifiers), replace[i] ?? replace.join('\n'))
|
||||
}
|
||||
|
||||
return message
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue