UNPKG

nestjs-graph

Version:

package for drawing dependency graph on HTML and serving it

26 lines (25 loc) 653 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GraphBuilder = void 0; const map_1 = require("./utils/map"); class GraphBuilder { constructor() { this.document = this.baseGraph(); } baseGraph() { return { edge: new Map(), }; } initEdge(module) { this.document.edge.set(module, []); } addEdge(from, to) { this.document.edge = this.document.edge.set(from, (0, map_1.mapSafeGetter)(this.document.edge, from).concat([to])); return this; } build() { return this.document; } } exports.GraphBuilder = GraphBuilder;