UNPKG

url-search-utils

Version:

Utils for manipulate search params in query string.

22 lines (13 loc) 1.69 kB
type ParamType$1 = ((value: string, acc: unknown) => unknown) | "array-of-strings" | "array-of-numbers" | "number" | "exclude"; declare function parseQuery(search: string, paramTypes?: Partial<Record<string, ParamType$1>>): Partial<Record<string, unknown>>; type AtomicParam = string | number | boolean; type Param = AtomicParam | readonly AtomicParam[]; type ParamType = ((value: Param | null) => AtomicParam | null) | "exclude" | "include-if-falsy"; declare function stringifyParams(params: Record<string, Param | null>, mapParamsNames?: Partial<Record<string, string>>, paramTypes?: Partial<Record<string, ParamType>>): string; declare function parseSearchParams(paramTypes?: Partial<Record<string, ParamType$1>>): Partial<Record<string, unknown>>; declare function parseHashParams(paramTypes?: Partial<Record<string, ParamType$1>>): Partial<Record<string, unknown>>; declare function parseHashLocationQuery(paramTypes?: Partial<Record<string, ParamType$1>>): Partial<Record<string, unknown>>; declare function setSearchParams(params: Record<string, Param | null>, mapParamsNames?: Partial<Record<string, string>>, paramTypes?: Partial<Record<string, ParamType>>): void; declare function setHashParams(params: Record<string, Param | null>, mapParamsNames?: Partial<Record<string, string>>, paramTypes?: Partial<Record<string, ParamType>>): void; declare function setHashLocationQuery(params: Record<string, Param | null>, mapParamsNames?: Partial<Record<string, string>>, paramTypes?: Partial<Record<string, ParamType>>): void; export { parseHashLocationQuery, parseHashParams, parseQuery, parseSearchParams, setHashLocationQuery, setHashParams, setSearchParams, stringifyParams };