MCPcopy Index your code
hub / github.com/Effect-TS/effect / findNode

Function findNode

packages/effect/src/Graph.ts:581–591  ·  view source on GitHub ↗
(
  graph: Graph<N, E, T> | MutableGraph<N, E, T>,
  predicate: (data: N) => boolean
)

Source from the content-addressed store, hash-verified

579 * @category getters
580 */
581export const findNode = <N, E, T extends Kind = "directed">(
582 graph: Graph<N, E, T> | MutableGraph<N, E, T>,
583 predicate: (data: N) => boolean
584): Option.Option<NodeIndex> => {
585 for (const [index, data] of graph.nodes) {
586 if (predicate(data)) {
587 return Option.some(index)
588 }
589 }
590 return Option.none()
591}
592
593/**
594 * Finds all nodes that match the given predicate.

Callers

nothing calls this directly

Calls 1

predicateFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…