-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy patharc.ts
More file actions
33 lines (28 loc) · 715 Bytes
/
arc.ts
File metadata and controls
33 lines (28 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
* Convert the call map to format D3 wants
* @param calledFunctions
*/
export function convertForArc(allFunctions: string[], calledFunctions: Map<string, string[]>) {
const nodes = [];
const links = [];
allFunctions.forEach((func: string) => {
nodes.push({
id: func,
group: 1, // later make this tied to an integer representing the file it came from
})
});
calledFunctions.forEach((childArr, key) => {
childArr.forEach((child) => {
links.push({
source: key,
target: child,
value: 1, // indicates 'strength' of connection -- leave as 1 for now
});
});
});
const all = {
nodes: nodes,
links: links,
};
return all;
}