predictype / predicates/urls/urlState / urlState
urlState(
source,oper):boolean
Defined in: predicates/urls/urlState.ts:36
Checks state flags of a URL (presence and protocol checks).
URL
The URL to inspect.
The state operation to perform (e.g. ‘has_hash’, ‘is_https’).
boolean
True if the state check is valid according to the operator, otherwise false.
If the operation is not recognized.
const source = new URL('https://user:pass@example.com:8443/docs?q=1#intro');
urlState(source, 'has_hash'); // true
urlState(source, 'has_search'); // true
urlState(source, 'has_port'); // true
urlState(source, 'is_https'); // true
Supported Operators: