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

Function visitFull

packages/effect/src/internal/redBlackTree.ts:946–969  ·  view source on GitHub ↗
(
  node: Node.Node<K, V>,
  visit: (key: K, value: V) => Option.Option<A>
)

Source from the content-addressed store, hash-verified

944}
945
946const visitFull = <K, V, A>(
947 node: Node.Node<K, V>,
948 visit: (key: K, value: V) => Option.Option<A>
949): Option.Option<A> => {
950 let current: Node.Node<K, V> | undefined = node
951 let stack: Stack.Stack<Node.Node<K, V>> | undefined = undefined
952 let done = false
953 while (!done) {
954 if (current != null) {
955 stack = Stack.make(current, stack)
956 current = current.left
957 } else if (stack != null) {
958 const value = visit(stack.value.key, stack.value.value)
959 if (Option.isSome(value)) {
960 return value
961 }
962 current = stack.value.right
963 stack = stack.previous
964 } else {
965 done = true
966 }
967 }
968 return Option.none()
969}
970
971const visitGreaterThanEqual = <K, V, A>(
972 node: Node.Node<K, V>,

Callers 1

redBlackTree.tsFile · 0.85

Calls 1

makeMethod · 0.65

Tested by

no test coverage detected