parse-relative-url.d.ts 599 B

12345678910111213141516
  1. /// <reference types="node" />
  2. import type { ParsedUrlQuery } from 'querystring';
  3. export interface ParsedRelativeUrl {
  4. hash: string;
  5. href: string;
  6. pathname: string;
  7. query: ParsedUrlQuery;
  8. search: string;
  9. }
  10. /**
  11. * Parses path-relative urls (e.g. `/hello/world?foo=bar`). If url isn't path-relative
  12. * (e.g. `./hello`) then at least base must be.
  13. * Absolute urls are rejected with one exception, in the browser, absolute urls that are on
  14. * the current origin will be parsed as relative
  15. */
  16. export declare function parseRelativeUrl(url: string, base?: string): ParsedRelativeUrl;