UNPKG

hd-utils

Version:

A handy utils for modern JS developers

15 lines (13 loc) 585 B
import { ParsedUrl, ParseOptions } from '../types'; /** * @description Extract the URL and the query string as an object. * If the `parseFragmentIdentifier` option is `true`, the object will also contain a `fragmentIdentifier` property. * @example ``` parseUrl('https://foo.bar?foo=bar'); //=> {url: 'https://foo.bar', query: {foo: 'bar'}} parseUrl('https://foo.bar?foo=bar#xyz', {parseFragmentIdentifier: true}); //=> {url: 'https://foo.bar', query: {foo: 'bar'}, fragmentIdentifier: 'xyz'} ``` */ export default function parseUrl(url: string, options?: ParseOptions): ParsedUrl;