codetrix
Version:
A lightweight lodash-style utility library
29 lines (28 loc) • 1.02 kB
TypeScript
/**
* Get query parameter value from a URL.
* @param url - The full URL string.
* @param key - The query parameter key.
* @returns The value of the query parameter or null if not found.
*/
export declare function getQueryParam(url: string, key: string): string | null;
/**
* Add or update a query parameter in a URL.
* @param url - The original URL.
* @param key - Query parameter key.
* @param value - Query parameter value.
* @returns The updated URL string.
*/
export declare function setQueryParam(url: string, key: string, value: string): string;
/**
* Remove a query parameter from a URL.
* @param url - The original URL.
* @param key - The query parameter to remove.
* @returns The updated URL without the query parameter.
*/
export declare function removeQueryParam(url: string, key: string): string;
/**
* Check if a URL is valid.
* @param url - The URL string to validate.
* @returns True if the URL is valid, otherwise false.
*/
export declare function isValidUrl(url: string): boolean;