hasProtocol(href) returns true when href carries a scheme://,
including a nested protocol like blob:http://…. It powers
isAbsolute, which treats any link with a
protocol as absolute. Part of pota/use/url.
| Argument | Type | Description |
|---|---|---|
href |
string |
The URL to test. |
Returns: true if the URL has a (possibly nested) protocol,
false otherwise.
Absolute and nested-protocol URLs return true; rootless relative
ones return false.
import { hasProtocol } from 'pota/use/url'
hasProtocol('http://local/') // true
hasProtocol('blob:http://local/') // true — nested protocol
hasProtocol('/about') // false
hasProtocol('about') // false