core/factories/graph.factory.ts

core/factories/graph.factory.ts is a file in GovLab Patterns. 7 lines of code and 2 definitions.

import { AnalysisGraph } from "#core/models/graph.model";
import type { Node } from "#types/graph.types";

export const graphOf = function graphOf(nodes: readonly Node[]): AnalysisGraph {
    const graph = new AnalysisGraph(nodes);
    graph.validate();
    return graph;
};