predictype / predicates/queries / querySize
querySize(
source,oper,size):boolean
Defined in: predicates/queries/querySize.ts:38
Checks the number of query entries against a numeric threshold.
URL | URLSearchParams
The query source to inspect (URL or URLSearchParams).
The size operation to perform (e.g. ‘size_equals’, ‘size_greater_than’).
number
The numeric threshold to compare against.
boolean
True if the size comparison is valid according to the operator, otherwise false.
If the operation is not recognized.
const source = new URLSearchParams('tag=ts&tag=ai&sort=desc');
const sizeA = 3;
const sizeB = 2;
querySize(source, 'size_equals', sizeA); // true
querySize(source, 'size_greater_than', sizeB); // true
Supported Operators: