mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 21:00:40 -07:00
feat: renderSync, parseAndRenderSync and renderFileSync, see #48
This commit is contained in:
+10
-3
@@ -47,10 +47,17 @@ export class Value {
|
||||
}
|
||||
this.filters.push(new Filter(name, args, this.strictFilters))
|
||||
}
|
||||
public value (ctx: Context) {
|
||||
let val = new Expression(this.initial).evaluate(ctx)
|
||||
public async value (ctx: Context) {
|
||||
let val = await new Expression(this.initial).evaluate(ctx)
|
||||
for (const filter of this.filters) {
|
||||
val = filter.render(val, ctx)
|
||||
val = await filter.render(val, ctx)
|
||||
}
|
||||
return val
|
||||
}
|
||||
public valueSync (ctx: Context) {
|
||||
let val = new Expression(this.initial).evaluateSync(ctx)
|
||||
for (const filter of this.filters) {
|
||||
val = filter.renderSync(val, ctx)
|
||||
}
|
||||
return val
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user