mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 12:50:38 -07:00
@@ -1,4 +1,4 @@
|
||||
import { evalToken } from '../../render/expression'
|
||||
import { _evalToken } from '../../render/expression'
|
||||
import { Context } from '../../context/context'
|
||||
import { identify } from '../../util/underscore'
|
||||
import { FilterImplOptions } from './filter-impl-options'
|
||||
@@ -17,11 +17,11 @@ export class Filter {
|
||||
this.args = args
|
||||
this.liquid = liquid
|
||||
}
|
||||
public render (value: any, context: Context) {
|
||||
public * render (value: any, context: Context): IterableIterator<unknown> {
|
||||
const argv: any[] = []
|
||||
for (const arg of this.args as FilterArg[]) {
|
||||
if (isKeyValuePair(arg)) argv.push([arg[0], evalToken(arg[1], context)])
|
||||
else argv.push(evalToken(arg, context))
|
||||
if (isKeyValuePair(arg)) argv.push([arg[0], yield _evalToken(arg[1], context)])
|
||||
else argv.push(yield _evalToken(arg, context))
|
||||
}
|
||||
return this.impl.apply({ context, liquid: this.liquid }, [value, ...argv])
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { evalToken } from '../../render/expression'
|
||||
import { _evalToken } from '../../render/expression'
|
||||
import { Context } from '../../context/context'
|
||||
import { Tokenizer } from '../../parser/tokenizer'
|
||||
|
||||
@@ -25,7 +25,7 @@ export class Hash {
|
||||
* render (ctx: Context): Generator<unknown, HashValue, unknown> {
|
||||
const hash = {}
|
||||
for (const key of Object.keys(this.hash)) {
|
||||
hash[key] = this.hash[key] === undefined ? true : yield evalToken(this.hash[key], ctx)
|
||||
hash[key] = this.hash[key] === undefined ? true : yield _evalToken(this.hash[key], ctx)
|
||||
}
|
||||
return hash
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user