Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 29x 29x 29x 29x 29x 108x 23x 23x 23x 131x | import { traverseAST } from './ast/traverseAst';
import { tokenize } from './ast/tokenize';
import { generateAST } from './ast/generateAst';
import { Cache } from '../utils/exported';
import { IBindingContext } from '../interface/exported';
/**
* creates binding expression by getting tokens from the text
*
*/
export function evaluateExpression(text: string, _class: IBindingContext) {
if (text) {
let ast: any;
if (Cache.astMap.has(text)) {
ast = Cache.astMap.get(text);
} else {
const tokens = tokenize(text);
ast = generateAST(tokens);
Cache.astMap.set(text, ast);
}
return traverseAST(ast, _class);
} else {
return '';
}
}
|