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

Function findExpressionInNode

packages/compiler/test/render3/view/util.ts:107–118  ·  view source on GitHub ↗
(node: a.Node, expr: string)

Source from the content-addressed store, hash-verified

105}
106
107function findExpressionInNode(node: a.Node, expr: string): e.AST | null {
108 if (node instanceof a.Element || node instanceof a.Template) {
109 return findExpression([...node.inputs, ...node.outputs, ...node.children], expr);
110 } else if (node instanceof a.BoundAttribute || node instanceof a.BoundText) {
111 const ts = toStringExpression(node.value);
112 return ts === expr ? node.value : null;
113 } else if (node instanceof a.BoundEvent) {
114 return toStringExpression(node.handler) === expr ? node.handler : null;
115 } else {
116 return null;
117 }
118}
119
120export function toStringExpression(expr: e.AST): string {
121 while (expr instanceof e.ASTWithSource) {

Callers 1

findExpressionFunction · 0.85

Calls 2

findExpressionFunction · 0.85
toStringExpressionFunction · 0.85

Tested by

no test coverage detected