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

findIndexForField.md

44 lines759 Bytes

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