feat: expose FilterToken to filter this, #762

This commit is contained in:
Yang Jun
2024-10-16 22:07:25 +08:00
committed by Jun Yang
parent 59da3fa543
commit d705888c8d
7 changed files with 36 additions and 20 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ export class Value {
? new Tokenizer(input, liquid.options.operators).readFilteredValue()
: input
this.initial = token.initial
this.filters = token.filters.map(({ name, args }) => new Filter(name, this.getFilter(liquid, name), args, liquid))
this.filters = token.filters.map(token => new Filter(token, this.getFilter(liquid, token.name), liquid))
}
public * value (ctx: Context, lenient?: boolean): Generator<unknown, unknown, unknown> {
lenient = lenient || (ctx.opts.lenientIf && this.filters.length > 0 && this.filters[0].name === 'default')