isAbsoluteUrl
Check whether a URL is absolute, including protocol-relative URLs, so you can decide when to resolve it against a base location.
Usage
isAbsoluteUrl checks whether a URL is an absolute path.
import { isAbsoluteUrl } from '@movk/core'
isAbsoluteUrl('https://example.com') // true
isAbsoluteUrl('/path/to/page') // false
isAbsoluteUrl('//example.com/path') // true (protocol-relative)
API
isAbsoluteUrl(url)
Check whether a URL is an absolute path.
Parameters
url
string required
The URL to check.
Returns
returns
boolean
Whether the URL is absolute.
Changelog
No recent changes