UNPKG

@rx-now/analysis

Version:

analysis tool for visualizing for code dependencies in typescript

18 lines (17 loc) 564 B
export class Graph { constructor() { this.graph = null; this.vertices = new Set(); } exists(value) { return !!Array.from(this.vertices).find((o) => o.value === value); } getNodeByValue(value) { return Array.from(this.vertices).find((o) => o.value === value); } getEdges() { return Array.from(this.vertices) .map((v) => Array.from(v.children).map((c) => ({ source: c, target: v }))) .reduce((previousValue, currentValue) => previousValue.concat(currentValue), []); } }