UNPKG

@typed/test

Version:
16 lines 504 B
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