refactor: delay creation of operatorsTrie and hide this implementation

BREAKING CHANGE: use `operators` instead of `operatorsTrie` as Tokenizer constructor argument, #500
This commit is contained in:
Jun Yang
2022-11-27 14:04:01 +08:00
parent ff112a4750
commit bb58d3e549
21 changed files with 86 additions and 96 deletions
+1 -4
View File
@@ -3,13 +3,10 @@ import { expect } from 'chai'
import { Drop } from '../../../src/drop/drop'
import { Context } from '../../../src/context/context'
import { toPromise, toValueSync } from '../../../src/util/async'
import { defaultOperators } from '../../../src/render/operator'
import { createTrie } from '../../../src/util/operator-trie'
describe('Expression', function () {
const ctx = new Context({})
const trie = createTrie(defaultOperators)
const create = (str: string) => new Tokenizer(str, trie).readExpression()
const create = (str: string) => new Tokenizer(str).readExpression()
it('should throw when context not defined', done => {
toPromise(create('foo').evaluate(undefined!, false))