predictype / predicates/queries/queryEntry / queryEntry
queryEntry(
source,oper,entry):boolean
Defined in: predicates/queries/queryEntry.ts:26
Checks whether query parameters contain or lack a specific [key, value] entry.
URL | URLSearchParams
The query source to inspect (URL or URLSearchParams).
The entry operation to perform (‘contains_entry’ or ‘lacks_entry’).
[string, string]
The [key, value] pair to check.
boolean
True if the entry check 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 entryA: [string, string] = ['tag', 'ai'];
const entryB: [string, string] = ['tag', 'rust'];
queryEntry(source, 'contains_entry', entryA); // true
queryEntry(source, 'lacks_entry', entryB); // true
Supported Operators: