toAbsoluteUrl
Resolve a relative URL against a base URL and return the absolute form, so links built from fragments point to the right location.
Usage
toAbsoluteUrl converts a relative URL into an absolute URL.
import { toAbsoluteUrl } from '@movk/core'
toAbsoluteUrl('/path', 'https://example.com')
// 'https://example.com/path'
toAbsoluteUrl('../other', 'https://example.com/api/users')
// 'https://example.com/api/other'
toAbsoluteUrl('https://other.com', 'https://example.com')
// 'https://other.com' (already absolute, returned as-is)
API
toAbsoluteUrl(relativeUrl, baseUrl)
Convert a relative URL to an absolute URL.
Parameters
relativeUrl
string required
The relative URL.
baseUrl
string required
The base URL.
Returns
returns
string
The absolute URL, or the original string if conversion fails.
Changelog
No recent changes
stringifyQuery
Serialize a query parameters object into a query string, with options for how repeated array values are formatted in the output.
stringifyMinimark
Serialize a Minimark-like AST into Markdown, supporting headings, lists, tables, and inline marks, and falling back to HTML for unsupported tags.