Open History to see the last commit
1---
2id: makeComparator
3title: makeComparator
4---
5
6```ts
7function makeComparator(opts, scope): (a, b) => number;
8```
9
10Defined in: [packages/db/src/utils/comparison.ts:141](https://github.com/TanStack/db/blob/main/packages/db/src/utils/comparison.ts#L141)
11
12**`Internal`**
13
14Used by first-party collection adapters.
15
16## Parameters
17
18### opts
19
20`CompareOptions`
21
22### scope
23
24`"values"` | `"index"`
25
26## Returns
27
28```ts
29(a, b): number;
30```
31
32### Parameters
33
34#### a
35
36`any`
37
38#### b
39
40`any`
41
42### Returns
43
44`number`