MCPcopy Create free account
hub / github.com/Snapchat/Valdi / getOrCreateNode

Method getOrCreateNode

npm_modules/cli/src/utils/Digraph.ts:64–73  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

62 }
63
64 getOrCreateNode(name: string): DigraphNode {
65 let node = this.nodeByName.get(name);
66 if (!node) {
67 node = { name, edges: [] };
68 this.nodeByName.set(name, node);
69 this._allNodes.push(node);
70 }
71
72 return node;
73 }
74
75 addEdge(from: string, to: string): void {
76 const fromNode = this.getOrCreateNode(from);

Callers 2

parseMethod · 0.95
addEdgeMethod · 0.95

Calls 3

getMethod · 0.65
setMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected