TanStack

findIndexForField

ts
function findIndexForField<TKey>(
   collection, 
   fieldPath, 
   compareOptions?, 
   canUse?): IndexReader<TKey> | undefined;

Defined in: packages/db/src/utils/index-optimization.ts:59

Finds the first usable index matching a field path and comparison options.

Type Parameters

TKey

TKey extends string | number

Parameters

collection

CollectionLike<any, TKey>

fieldPath

string[]

compareOptions?

CompareOptions

canUse?

(index) => boolean

Returns

IndexReader<TKey> | undefined