UNPKG

@nrwl/workspace

Version:

The Workspace plugin contains executors and generators that are useful for any Nx workspace. It should be present in every Nx workspace and other plugins build on it.

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