archunit
Version:
ArchUnit TypeScript is an architecture testing library, to specify and assert architecture rules in your TypeScript app
23 lines • 777 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.projectEdges = void 0;
const projectEdges = (graph, mapper) => {
const builtGraph = [];
for (const edge of graph) {
const mapped = mapper(edge);
if (mapped === undefined) {
continue;
}
const matchingEdge = builtGraph.find((mappedEdge) => mappedEdge.sourceLabel === mapped.sourceLabel &&
mappedEdge.targetLabel === mapped.targetLabel);
if (matchingEdge) {
matchingEdge.cumulatedEdges.push(edge);
}
else {
builtGraph.push({ ...mapped, cumulatedEdges: [edge] });
}
}
return builtGraph;
};
exports.projectEdges = projectEdges;
//# sourceMappingURL=project-edges.js.map