MCPcopy Create free account
hub / github.com/TanStack/db / getPairOrNextLower

Method getPairOrNextLower

packages/db/src/utils/btree.ts:731–750  ·  view source on GitHub ↗
(
    key: K,
    compare: (a: K, b: K) => number,
    inclusive: boolean,
    reusedArray: [K, V],
  )

Source from the content-addressed store, hash-verified

729 }
730
731 getPairOrNextLower(
732 key: K,
733 compare: (a: K, b: K) => number,
734 inclusive: boolean,
735 reusedArray: [K, V],
736 ): [K, V] | undefined {
737 const i = this.indexOf(key, 0, compare),
738 children = this.children
739 if (i >= children.length) return this.maxPair(reusedArray)
740 const result = children[i]!.getPairOrNextLower(
741 key,
742 compare,
743 inclusive,
744 reusedArray,
745 )
746 if (result === undefined && i > 0) {
747 return children[i - 1]!.maxPair(reusedArray)
748 }
749 return result
750 }
751
752 getPairOrNextHigher(
753 key: K,

Callers

nothing calls this directly

Calls 4

maxPairMethod · 0.95
indexOfMethod · 0.45
getPairOrNextLowerMethod · 0.45
maxPairMethod · 0.45

Tested by

no test coverage detected