diff --git a/src/query.ts b/src/query.ts index b4edb2f8..f4c8d2f5 100644 --- a/src/query.ts +++ b/src/query.ts @@ -11,10 +11,12 @@ export type QueryValue = | undefined | null | Record; + export type QueryObject = Record; +export type ParsedQuery = Record; -export function parseQuery(parametersString = ""): QueryObject { - const object: QueryObject = {}; +export function parseQuery(parametersString = ""): ParsedQuery { + const object: ParsedQuery = {}; if (parametersString[0] === "?") { parametersString = parametersString.slice(1); } diff --git a/src/utils.ts b/src/utils.ts index cae821dd..7365c009 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,6 +1,6 @@ import { $URL } from "./url"; import { parseURL, stringifyParsedURL } from "./parse"; -import { QueryObject, parseQuery, stringifyQuery } from "./query"; +import { ParsedQuery, QueryObject, parseQuery, stringifyQuery } from "./query"; import { decode } from "./encoding"; export function isRelative(inputString: string) { @@ -132,7 +132,7 @@ export function withQuery(input: string, query: QueryObject): string { return stringifyParsedURL(parsed); } -export function getQuery(input: string): QueryObject { +export function getQuery(input: string): ParsedQuery { return parseQuery(parseURL(input).search); }