url-modify
Version:
Modify URL instances cleanly and safely. Works in any environment that supports the URL API.
16 lines (15 loc) • 563 B
TypeScript
export interface UrlModifyModifications {
hash?: string;
host?: string;
password?: string;
path?: string;
port?: string;
protocol?: string;
search?: string | string[][] | Record<string, string> | URLSearchParams;
username?: string;
}
export interface UrlModifyOptions {
pathBehavior?: 'append' | 'prepend' | 'replace';
searchBehavior?: 'append' | 'clear' | 'replace';
}
export declare const urlModify: (modifications: UrlModifyModifications, base: string | URL, { pathBehavior, searchBehavior }?: UrlModifyOptions) => URL;