MCPcopy Create free account
hub / github.com/angular/angular / findExpression

Function findExpression

packages/compiler/test/render3/view/util.ts:90–105  ·  view source on GitHub ↗
(tmpl: a.Node[], expr: string)

Source from the content-addressed store, hash-verified

88}
89
90export function findExpression(tmpl: a.Node[], expr: string): e.AST | null {
91 const res = tmpl.reduce(
92 (found, node) => {
93 if (found !== null) {
94 return found;
95 } else {
96 return findExpressionInNode(node, expr);
97 }
98 },
99 null as e.AST | null,
100 );
101 if (res instanceof e.ASTWithSource) {
102 return res.ast;
103 }
104 return res;
105}
106
107function findExpressionInNode(node: a.Node, expr: string): e.AST | null {
108 if (node instanceof a.Element || node instanceof a.Template) {

Callers 2

binding_spec.tsFile · 0.90
findExpressionInNodeFunction · 0.85

Calls 2

findExpressionInNodeFunction · 0.85
reduceMethod · 0.80

Tested by

no test coverage detected