parseUrl 函数用于解析 URL 字符串为结构化对象。
import { parseUrl } from '@movk/core'
parseUrl('https://example.com:8080/path?query=1#hash')
// {
// href: 'https://example.com:8080/path?query=1#hash',
// protocol: 'https:',
// host: 'example.com:8080',
// hostname: 'example.com',
// port: '8080',
// pathname: '/path',
// search: '?query=1',
// hash: '#hash',
// auth: '',
// origin: 'https://example.com:8080'
// }
parseUrl('/path', 'https://example.com')
// 解析相对 URL
parseUrl(url, base?)解析 URL 字符串为结构化对象。
null。