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

isOrderBySubset.md

42 lines924 Bytes

1---
2id: isOrderBySubset
3title: isOrderBySubset
4---
5​
6# Function: isOrderBySubset()
7​
8```ts
9function isOrderBySubset(subset, superset): boolean;
10```
11​
12Defined in: [packages/db/src/query/predicate-utils.ts:715](https://github.com/TanStack/db/blob/main/packages/db/src/query/predicate-utils.ts#L715)
13​
14Check if one orderBy clause is a subset of another.
15Returns true if the subset ordering requirements are satisfied by the superset ordering.
16​
17## Parameters
18​
19### subset
20​
21The ordering requirements to check
22​
23[`OrderBy`](../@tanstack/namespaces/IR/type-aliases/OrderBy.md) | `undefined`
24​
25### superset
26​
27The ordering that might satisfy the requirements
28​
29[`OrderBy`](../@tanstack/namespaces/IR/type-aliases/OrderBy.md) | `undefined`
30​
31## Returns
32​
33`boolean`
34​
35true if subset is satisfied by superset
36​
37## Example
38​
39```ts
40// Subset is prefix of superset
41isOrderBySubset([{expr: age, asc}], [{expr: age, asc}, {expr: name, desc}]) // true
42```