Skip to main content

Function: resolveFirstValueInLinkedStructure()

function resolveFirstValueInLinkedStructure<Node, Value>(
options: Readonly<{
getNextNode: (node: Node) => Node | null;
resolveValue: (node: Node) => LinkedStructureLookupResult<Value>;
startNode: Node | null;
}>
): LinkedStructureLookupResult<Value>;

Defined in: _internal/cycle-safe-linked-search.ts:36

Resolve the first matching value while traversing a linked structure.

Type Parametersโ€‹

Nodeโ€‹

Node

Valueโ€‹

Value

Parametersโ€‹

optionsโ€‹

Readonly<{ getNextNode: (node: Node) => Node | null; resolveValue: (node: Node) => LinkedStructureLookupResult<Value>; startNode: Node | null; }>

Linked-structure traversal options.

  • startNode: Initial node to inspect.
  • getNextNode: Function that returns the next node in the chain.
  • resolveValue: Function that returns a lookup result for the current node.

Returnsโ€‹

LinkedStructureLookupResult<Value>

Lookup result for the first resolved value; otherwise a non-matching lookup result when traversal reaches the chain end or detects a parent-cycle.