refactor: remove use of internal Context class in evalValue argument

BREAKING CHANGE: `evalValue` won't support `Context` as second argument anymore.
This commit is contained in:
Jun Yang
2022-11-27 14:04:01 +08:00
parent bb58d3e549
commit b115077e12
2 changed files with 7 additions and 17 deletions
+6 -6
View File
@@ -90,16 +90,16 @@ export class Liquid {
return this.renderToNodeStream(templates, scope, renderOptions)
}
public _evalValue (str: string, scopeOrContext?: object | Context): IterableIterator<any> {
public _evalValue (str: string, scope?: object): IterableIterator<any> {
const value = new Value(str, this)
const ctx = scopeOrContext instanceof Context ? scopeOrContext : new Context(scopeOrContext, this.options)
const ctx = new Context(scope, this.options)
return value.value(ctx, false)
}
public async evalValue (str: string, scopeOrContext?: object | Context): Promise<any> {
return toPromise(this._evalValue(str, scopeOrContext))
public async evalValue (str: string, scope?: object): Promise<any> {
return toPromise(this._evalValue(str, scope))
}
public evalValueSync (str: string, scopeOrContext?: object | Context): any {
return toValueSync(this._evalValue(str, scopeOrContext))
public evalValueSync (str: string, scope?: object): any {
return toValueSync(this._evalValue(str, scope))
}
public registerFilter (name: string, filter: FilterImplOptions) {