isRelativeUrl
Check whether a URL is a relative path rather than an absolute or protocol-relative URL, useful before joining it to a base.
Usage
isRelativeUrl checks whether a URL is a relative path.
import { isRelativeUrl } from '@movk/core'
isRelativeUrl('/path/to/page') // true
isRelativeUrl('./page') // true
isRelativeUrl('../page') // true
isRelativeUrl('https://example.com') // false
API
isRelativeUrl(url)
Check whether a URL is a relative path.
Parameters
url
string required
The URL to check.
Returns
returns
boolean
Whether the URL is a relative path.
Changelog
No recent changes