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

Function edges

packages/effect/src/Graph.ts:5710–5729  ·  view source on GitHub ↗
(
  graph: Graph<N, E, T> | MutableGraph<N, E, T>
)

Source from the content-addressed store, hash-verified

5708 * @since 3.18.0
5709 */
5710export const edges = <N, E, T extends Kind = "directed">(
5711 graph: Graph<N, E, T> | MutableGraph<N, E, T>
5712): EdgeWalker<E> =>
5713 new Walker((f) => ({
5714 [Symbol.iterator]() {
5715 const edgeMap = graphImpl(graph).edges
5716 const iterator = edgeMap.entries()
5717
5718 return {
5719 next() {
5720 const result = iterator.next()
5721 if (result.done) {
5722 return { done: true, value: undefined }
5723 }
5724 const [edgeIndex, edgeData] = result.value
5725 return { done: false, value: f(edgeIndex, edgeData) }
5726 }
5727 }
5728 }
5729 }))
5730
5731/**
5732 * Configuration for selecting external nodes.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected