(sourceFile: ts.SourceFile)
| 188 | * @returns {Array<ts.Node>} An array of all the nodes in the source. |
| 189 | */ |
| 190 | export function getSourceNodes(sourceFile: ts.SourceFile): ts.Node[] { |
| 191 | const nodes: ts.Node[] = [sourceFile]; |
| 192 | |
| 193 | // NOTE: nodes.length changes inside of the loop but we only append to the end |
| 194 | for (let i = 0; i < nodes.length; i++) { |
| 195 | const node = nodes[i]; |
| 196 | nodes.push(...node.getChildren(sourceFile)); |
| 197 | } |
| 198 | |
| 199 | return nodes; |
| 200 | } |
| 201 | |
| 202 | export function findNode(node: ts.Node, kind: ts.SyntaxKind, text: string): ts.Node | null { |
| 203 | if (node.kind === kind && node.getText() === text) { |
no test coverage detected