UNPKG

archunit

Version:

ArchUnit TypeScript is an architecture testing library, to specify and assert architecture rules in your TypeScript app

21 lines 874 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.projectToNodes = void 0; const projectToNodes = (graph, options = {}) => { const filteredGraph = options.includeExternals ? graph : graph.filter((e) => !e.external); // Get unique file names from both sources and targets const uniqueFiles = new Set([ ...filteredGraph.map((edge) => edge.target), ...filteredGraph.map((edge) => edge.source), ]); // Transform to projected nodes with incoming and outgoing edges return Array.from(uniqueFiles).map((fileName) => ({ label: fileName, incoming: filteredGraph.filter((edge) => edge.target === fileName), outgoing: filteredGraph.filter((edge) => edge.source === fileName), })); }; exports.projectToNodes = projectToNodes; //# sourceMappingURL=project-nodes.js.map