mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 12:50:38 -07:00
feat: create trie programmatically in options
This commit is contained in:
committed by
Jun Yang
parent
8734e2e6ce
commit
befc33c4eb
@@ -13,7 +13,7 @@ import { Tokenizer } from '../../parser/tokenizer'
|
||||
export class Hash {
|
||||
hash: { [key: string]: any } = {}
|
||||
constructor (markup: string) {
|
||||
const tokenizer = new Tokenizer(markup)
|
||||
const tokenizer = new Tokenizer(markup, {})
|
||||
for (const hash of tokenizer.readHashes()) {
|
||||
this.hash[hash.name.content] = hash.value
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ export class Value {
|
||||
* @param str the value to be valuated, eg.: "foobar" | truncate: 3
|
||||
*/
|
||||
public constructor (str: string, private readonly filterMap: FilterMap, liquid: Liquid) {
|
||||
const tokenizer = new Tokenizer(str)
|
||||
const tokenizer = new Tokenizer(str, liquid.options.operatorsTrie)
|
||||
this.initial = tokenizer.readValue()
|
||||
this.filters = tokenizer.readFilters().map(({ name, args }) => new Filter(name, this.filterMap.get(name), args, liquid))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user