Skip to content
Source
Sign inSign up
TanStack/db
Open History to see the last commit

findIndexForField.md

39 lines705 Bytes

1---
2id: findIndexForField
3title: findIndexForField
4---
5​
6```ts
7function findIndexForField<TKey>(
8 collection,
9 fieldPath,
10 compareOptions?): IndexReader<TKey> | undefined;
11```
12​
13Defined in: [packages/db/src/utils/index-optimization.ts:45](https://github.com/TanStack/db/blob/main/packages/db/src/utils/index-optimization.ts#L45)
14​
15Finds an index that matches a given field path
16​
17## Type Parameters
18​
19### TKey
20​
21`TKey` *extends* `string` \| `number`
22​
23## Parameters
24​
25### collection
26​
27[`CollectionLike`](../interfaces/CollectionLike.md)\<`any`, `TKey`\>
28​
29### fieldPath
30​
31`string`[]
32​
33### compareOptions?
34​
35`CompareOptions`
36​
37## Returns
38​
39[`IndexReader`](../type-aliases/IndexReader.md)\<`TKey`\> \| `undefined`