UNPKG

angular-ide

Version:

Provides a seamless integration with the Angular IDE from the command-line for developers looking for an enhanced development experience with Angular.

25 lines (21 loc) 630 B
const ts = require('typescript'); function findOriginal(sourceFileNode) { if (sourceFileNode.original) { return findOriginal(sourceFileNode.original) } return sourceFileNode; } function collectDeepNodes(node, kind) { const kinds = Array.isArray(kind) ? kind : [kind]; const nodes = []; const helper = (child) => { if (kinds.includes(child.kind)) { nodes.push(child); } ts.forEachChild(child, helper); }; ts.forEachChild(node, helper); return nodes; } module.exports.collectDeepNodes = collectDeepNodes; module.exports.findOriginal = findOriginal;