UNPKG

@nrwl/workspace

Version:

Smart, Fast and Extensible Build System.

32 lines 820 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.findNodes = void 0; function findNodes(node, kind, max = Infinity) { if (!node || max == 0) { return []; } const arr = []; const hasMatch = Array.isArray(kind) ? kind.includes(node.kind) : node.kind === kind; if (hasMatch) { arr.push(node); max--; } if (max > 0) { for (const child of node.getChildren()) { findNodes(child, kind, max).forEach((node) => { if (max > 0) { arr.push(node); } max--; }); if (max <= 0) { break; } } } return arr; } exports.findNodes = findNodes; //# sourceMappingURL=find-nodes.js.map