predictype / predicates/urls/urlHash / urlHash
urlHash(
source,oper,target):boolean
Defined in: predicates/urls/urlHash.ts:30
Checks the hash component of a URL against a string operation.
URL
The URL to inspect.
The hash operation to perform (e.g. ‘equals’, ‘starts_with’).
string
The string to compare against source.hash.
boolean
True if the hash comparison is valid according to the operator, otherwise false.
If the operation is not recognized.
const source = new URL('https://example.com/docs#install');
const targetA = '#install';
const targetB = '#guide';
urlHash(source, 'equals', targetA); // true
urlHash(source, 'not_equals', targetB); // true
Supported Operators: