predictype / predicates/queries / queryState
queryState(
source,oper):boolean
Defined in: predicates/queries/queryState.ts:33
Checks whether query parameters are empty or not empty.
URL | URLSearchParams
The query source to inspect (URL or URLSearchParams).
The state operation to perform (‘is_empty’ or ‘is_not_empty’).
boolean
True if the state check is valid according to the operator, otherwise false.
If the operation is not recognized.
const sourceA = new URLSearchParams('q=predicate');
const sourceB = new URLSearchParams('');
queryState(sourceA, 'is_not_empty'); // true
queryState(sourceB, 'is_empty'); // true
Supported Operators: