@riogz/router
Version:
A simple, lightweight, powerful, view-agnostic, modular and extensible router
28 lines (27 loc) • 1.02 kB
TypeScript
import { IOptions } from './encode';
export type { IOptions };
export type SearchParams = Record<string, string | boolean | null | Array<string | boolean | null> | undefined>;
/**
* Parse a querystring and return an object of parameters
*/
export declare const parse: <T extends Record<string, any> = SearchParams>(path: string, opts?: IOptions) => T;
/**
* Build a querystring from an object of parameters
*/
export declare const build: <T extends Record<string, any> = SearchParams>(params: T, opts?: IOptions) => string;
export interface IOmitResponse {
querystring: string;
removedParams: object;
}
/**
* Remove a list of parameters from a querystring
*/
export declare const omit: (path: string, paramsToOmit: string[], opts?: IOptions) => IOmitResponse;
export interface IKeepResponse {
querystring: string;
keptParams: object;
}
/**
* Remove a list of parameters from a querystring
*/
export declare const keep: (path: string, paramsToKeep: string[], opts?: IOptions) => IKeepResponse;