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