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

Method nextHigherPair

packages/db/src/utils/btree.ts:244–255  ·  view source on GitHub ↗

Returns the next pair whose key is larger than the specified key (or undefined if there is none). * If key === undefined, this function returns the lowest pair. * @param key The key to search for. * @param reusedArray Optional array used repeatedly to store key-value pairs, to * avoid cr

(key: K | undefined, reusedArray?: [K, V])

Source from the content-addressed store, hash-verified

242 * avoid creating a new array on every iteration.
243 */
244 nextHigherPair(key: K | undefined, reusedArray?: [K, V]): [K, V] | undefined {
245 reusedArray = reusedArray || ([] as unknown as [K, V])
246 if (key === undefined) {
247 return this._root.minPair(reusedArray)
248 }
249 return this._root.getPairOrNextHigher(
250 key,
251 this._compare,
252 false,
253 reusedArray,
254 )
255 }
256
257 /** Returns the next key larger than the specified key, or undefined if there is none.
258 * Also, nextHigherKey(undefined) returns the lowest key.

Callers 4

nextHigherKeyMethod · 0.95
nextPairMethod · 0.80
insertMethod · 0.80
deleteMethod · 0.80

Calls 2

minPairMethod · 0.45
getPairOrNextHigherMethod · 0.45

Tested by

no test coverage detected