Introduce TermOperator helper and refactor execute()s to use replaceSubjectMatchingTerm
This commit is contained in:
@@ -19,7 +19,8 @@ export class Suffix extends Command<{ with: StrTerm }> {
|
||||
}
|
||||
|
||||
execute(vm: StrVM, data: { with: StrTerm }): Awaitable<StrVM> {
|
||||
return vm.tapInPlace(ctx =>
|
||||
ctx.replaceSubjectAsString(sub => `${sub}${ctx.resolveString(data.with)}`))
|
||||
return vm.replaceContextMatchingTerm(ctx => ({
|
||||
string: sub => `${sub}${ctx.resolveString(data.with)}`,
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user