mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-18 14:00:39 -07:00
docs: update docs and demo for Value usage, fixes #568
This commit is contained in:
+1
-1
@@ -79,7 +79,7 @@ export class Liquid {
|
||||
public _evalValue (str: string, scope?: object | Context): IterableIterator<any> {
|
||||
const value = new Value(str, this)
|
||||
const ctx = scope instanceof Context ? scope : new Context(scope, this.options)
|
||||
return value.value(ctx, false)
|
||||
return value.value(ctx)
|
||||
}
|
||||
public async evalValue (str: string, scope?: object | Context): Promise<any> {
|
||||
return toPromise(this._evalValue(str, scope))
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user