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

isOrderBySubset.md

42 lines924 Bytes

Function: isOrderBySubset()

function isOrderBySubset(subset, superset): boolean;

Defined in: packages/db/src/query/predicate-utils.ts:715

Check if one orderBy clause is a subset of another. Returns true if the subset ordering requirements are satisfied by the superset ordering.

Parameters

subset

The ordering requirements to check

OrderBy | undefined

superset

The ordering that might satisfy the requirements

OrderBy | undefined

Returns

boolean

true if subset is satisfied by superset

Example

// Subset is prefix of superset
isOrderBySubset([{expr: age, asc}], [{expr: age, asc}, {expr: name, desc}]) // true