@typed/test
Version:
Testing made simple.
16 lines • 504 B
JavaScript
import { forEachChild } from 'typescript';
export function findNode(predicate, sourceNodes) {
return new Promise((resolve, reject) => {
for (const node of sourceNodes) {
visitChildren(node);
}
function visitChildren(node) {
if (predicate(node)) {
return resolve(node);
}
forEachChild(node, visitChildren);
}
reject(new Error('Unable to find Node'));
});
}
//# sourceMappingURL=findNode.js.map