docs: update docs and demo for Value usage, fixes #568

This commit is contained in:
Harttle
2022-12-14 02:14:03 +08:00
committed by Harttle
parent a9f93d7235
commit d24655887f
12 changed files with 187 additions and 127 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ export class Value {
this.initial = tokenizer.readExpression()
this.filters = tokenizer.readFilters().map(({ name, args }) => new Filter(name, this.getFilter(liquid, name), args, liquid))
}
public * value (ctx: Context, lenient: boolean): Generator<unknown, unknown, unknown> {
public * value (ctx: Context, lenient?: boolean): Generator<unknown, unknown, unknown> {
lenient = lenient || (ctx.opts.lenientIf && this.filters.length > 0 && this.filters[0].name === 'default')
let val = yield this.initial.evaluate(ctx, lenient)