(node: string, graph: Graph, subnodes = new Set())
| 114 | * closure at `node`. |
| 115 | */ |
| 116 | export function findSubgraph(node: string, graph: Graph, subnodes = new Set()) { |
| 117 | const directSubnodes = graph[node]; |
| 118 | if (directSubnodes) { |
| 119 | for (const directSubnode of directSubnodes) { |
| 120 | if (!subnodes.has(directSubnode)) { |
| 121 | subnodes.add(directSubnode); |
| 122 | findSubgraph(directSubnode, graph, subnodes); |
| 123 | } |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | return subnodes; |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * Find the transitive closure of dependencies of the given packages. |
no test coverage detected
searching dependent graphs…