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

Function findAllMatchingNodes

packages/language-service/src/utils/ts_utils.ts:46–56  ·  view source on GitHub ↗
(root: ts.Node, opts: FindOptions<T>)

Source from the content-addressed store, hash-verified

44 * Finds TypeScript nodes descending from the provided root which match the given filter.
45 */
46export function findAllMatchingNodes<T extends ts.Node>(root: ts.Node, opts: FindOptions<T>): T[] {
47 const matches: T[] = [];
48 const explore = (currNode: ts.Node) => {
49 if (opts.filter(currNode)) {
50 matches.push(currNode);
51 }
52 currNode.forEachChild((descendent) => explore(descendent));
53 };
54 explore(root);
55 return matches;
56}
57
58/**
59 * Finds TypeScript nodes descending from the provided root which match the given filter.

Callers 2

Calls 1

exploreFunction · 0.85

Tested by

no test coverage detected