mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 21:00:40 -07:00
feat: use evalValue to parse & render expression, #527
This commit is contained in:
+6
-5
@@ -90,15 +90,16 @@ export class Liquid {
|
||||
return this.renderToNodeStream(templates, scope, renderOptions)
|
||||
}
|
||||
|
||||
public _evalValue (str: string, ctx: Context): IterableIterator<any> {
|
||||
public _evalValue (str: string, scopeOrContext?: object | Context): IterableIterator<any> {
|
||||
const value = new Value(str, this)
|
||||
const ctx = scopeOrContext instanceof Context ? scopeOrContext : new Context(scopeOrContext, this.options)
|
||||
return value.value(ctx, false)
|
||||
}
|
||||
public async evalValue (str: string, ctx: Context): Promise<any> {
|
||||
return toPromise(this._evalValue(str, ctx))
|
||||
public async evalValue (str: string, scopeOrContext?: object | Context): Promise<any> {
|
||||
return toPromise(this._evalValue(str, scopeOrContext))
|
||||
}
|
||||
public evalValueSync (str: string, ctx: Context): any {
|
||||
return toValueSync(this._evalValue(str, ctx))
|
||||
public evalValueSync (str: string, scopeOrContext?: object | Context): any {
|
||||
return toValueSync(this._evalValue(str, scopeOrContext))
|
||||
}
|
||||
|
||||
public registerFilter (name: string, filter: FilterImplOptions) {
|
||||
|
||||
Reference in New Issue
Block a user