MCPcopy Create free account
hub / github.com/Effect-TS/effect / endMutation

Function endMutation

packages/effect/src/Graph.ts:639–658  ·  view source on GitHub ↗
(
  mutable: MutableGraph<N, E, T>
)

Source from the content-addressed store, hash-verified

637 * @since 3.18.0
638 */
639export const endMutation = <N, E, T extends Kind = "directed">(
640 mutable: MutableGraph<N, E, T>
641): Graph<N, E, T> => {
642 assertMutable(mutable)
643 const source = graphImpl(mutable)
644
645 const graph: Mutable<GraphImpl<N, E, T>> = Object.create(ProtoGraph)
646 graph.type = source.type
647 graph.nodes = new Map(source.nodes)
648 graph.edges = new Map(source.edges)
649 graph.adjacency = cloneAdjacency(source.adjacency)
650 graph.reverseAdjacency = cloneAdjacency(source.reverseAdjacency)
651 graph.nextNodeIndex = source.nextNodeIndex
652 graph.nextEdgeIndex = source.nextEdgeIndex
653 graph.acyclic = source.acyclic
654 graph.mutable = false
655 source.mutable = false
656
657 return graph as unknown as Graph<N, E, T>
658}
659
660/** @internal */
661const mutateScoped = <N, E, T extends Kind>(

Callers 1

mutateScopedFunction · 0.70

Calls 3

assertMutableFunction · 0.85
graphImplFunction · 0.85
cloneAdjacencyFunction · 0.85

Tested by

no test coverage detected