UNPKG

1.23 kBTypeScriptView Raw
1import { IOptions } from './encode';
2export { IOptions };
3export declare type SearchParams = Record<string, string | boolean | null | Array<string | boolean | null> | undefined>;
4/**
5 * Parse a querystring and return an object of parameters
6 */
7export declare const parse: <T extends Record<string, any> = Record<string, string | boolean | (string | boolean | null)[] | null | undefined>>(path: string, opts?: IOptions | undefined) => T;
8/**
9 * Build a querystring from an object of parameters
10 */
11export declare const build: <T extends Record<string, any> = Record<string, string | boolean | (string | boolean | null)[] | null | undefined>>(params: T, opts?: IOptions | undefined) => string;
12export interface IOmitResponse {
13 querystring: string;
14 removedParams: object;
15}
16/**
17 * Remove a list of parameters from a querystring
18 */
19export declare const omit: (path: string, paramsToOmit: string[], opts?: IOptions | undefined) => IOmitResponse;
20export interface IKeepResponse {
21 querystring: string;
22 keptParams: object;
23}
24/**
25 * Remove a list of parameters from a querystring
26 */
27export declare const keep: (path: string, paramsToKeep: string[], opts?: IOptions | undefined) => IKeepResponse;