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

isPredicateSubset.md

44 lines932 Bytes

1---
2id: isPredicateSubset
3title: isPredicateSubset
4---
5​
6# Function: isPredicateSubset()
7​
8```ts
9function isPredicateSubset(subset, superset): boolean;
10```
11​
12Defined in: [packages/db/src/query/predicate-utils.ts:856](https://github.com/TanStack/db/blob/main/packages/db/src/query/predicate-utils.ts#L856)
13​
14Check if one predicate (where + orderBy + limit + offset) is a subset of another.
15Returns true if all aspects of the subset predicate are satisfied by the superset.
16​
17## Parameters
18​
19### subset
20​
21[`LoadSubsetOptions`](../type-aliases/LoadSubsetOptions.md)
22​
23The predicate requirements to check
24​
25### superset
26​
27[`LoadSubsetOptions`](../type-aliases/LoadSubsetOptions.md)
28​
29The predicate that might satisfy the requirements
30​
31## Returns
32​
33`boolean`
34​
35true if subset is satisfied by superset
36​
37## Example
38​
39```ts
40isPredicateSubset(
41 { where: gt(ref('age'), val(20)), limit: 10 },
42 { where: gt(ref('age'), val(10)), limit: 20 }
43) // true
44```