feat(filters): add squish filter (#943)

This commit is contained in:
MildlyMeticulous
2026-08-11 20:52:07 +08:00
committed by GitHub
parent f88a528e27
commit 875513f4c5
4 changed files with 45 additions and 0 deletions
+6
View File
@@ -128,6 +128,12 @@ export function strip_newlines (this: FilterImpl, v: string) {
return str.replace(/\r?\n/gm, '')
}
export function squish (this: FilterImpl, v: string) {
const str = stringify(v)
this.context.memoryLimit.use(str.length)
return str.replace(/\s+/g, ' ').trim()
}
export function capitalize (this: FilterImpl, str: string) {
str = stringify(str)
this.context.memoryLimit.use(str.length)