MCPcopy
hub / github.com/formatjs/formatjs / invertGraph

Function invertGraph

tools/release-please/npm-workspace-graph.ts:148–162  ·  view source on GitHub ↗
(graph: DependencyGraph)

Source from the content-addressed store, hash-verified

146}
147
148function invertGraph(graph: DependencyGraph): DependencyGraph {
149 const dependentGraph: DependencyGraph = new Map()
150 for (const [name, node] of graph) {
151 dependentGraph.set(name, {
152 deps: [],
153 value: node.value,
154 })
155 }
156 for (const [name, node] of graph) {
157 for (const depName of node.deps) {
158 dependentGraph.get(depName)?.deps.push(name)
159 }
160 }
161 return dependentGraph
162}
163
164function visitDependents(
165 graph: DependencyGraph,

Callers 1

dependentPackageOrderFunction · 0.85

Calls 2

setMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected