@typed/test
Version:
Testing made simple.
13 lines • 393 B
JavaScript
import { forEachChild, SyntaxKind } from 'typescript';
export function traverseNode(f, seed, sourceFile) {
let acc = seed;
visitChildren(sourceFile);
return acc;
function visitChildren(node) {
if (node.kind !== SyntaxKind.SourceFile) {
acc = f(acc, node);
}
forEachChild(node, visitChildren);
}
}
//# sourceMappingURL=traverseNode.js.map