/** * Checks if a URL has query parameters. * * @param url - The URL to check. * @returns True if the URL has query parameters, false otherwise. * * @example * hasParams('https://example.com?page=1'); // true * hasParams('https://example.com'); // false */ declare function hasParams(url: string): boolean; /** * Removes the trailing slash from a pathname if present. * * @param pathname - The pathname to process. * @returns The pathname without the trailing slash. * * @example * removeLastSlash('/dashboard/'); // '/dashboard' * removeLastSlash('/dashboard'); // '/dashboard' */ declare function removeLastSlash(pathname: string): string; /** * Checks if two paths are equal after removing trailing slashes. * * @param targetUrl - The target URL to compare. * @param currentUrl - The pathname to compare. * @param options.deep - Options for deep comparison. * @returns True if the paths are equal, false otherwise. * * @example * isEqualPath('/dashboard/', '/dashboard'); // true * isEqualPath('/home', '/dashboard'); // false */ type EqualPathOptions = { deep?: boolean; }; declare function isEqualPath(targetUrl: string, currentUrl: string, options?: EqualPathOptions): boolean; /** * Removes query parameters from a URL and returns only the cleaned pathname. * * @param url - The URL to process. * @returns The pathname without query parameters. * * @example * removeParams('https://example.com/dashboard/user?id=123'); // '/dashboard/user' * removeParams('/dashboard/user?id=123'); // '/dashboard/user' */ declare function removeParams(url: string): string; /** * Determines whether a given URL is external (i.e., starts with "http"). * * @param url - The URL to check. * @returns True if the URL is external, false otherwise. * * @example * isExternalLink('https://example.com'); // true * isExternalLink('/internal'); // false */ declare function isExternalLink(url: string): boolean; /** * Safely returns a URL or a fallback if the URL is invalid or not same-origin. * * @param value - The URL to validate. * @param fallback - The fallback URL to return if the value is invalid. * @returns A safe URL or the fallback. * * @example * safeReturnUrl('/dashboard', '/home'); // '/dashboard' * safeReturnUrl('https://example.com', '/home'); // '/' */ declare function safeReturnUrl(value: string | null, fallback?: string | null): string; export { type EqualPathOptions, hasParams, isEqualPath, isExternalLink, removeLastSlash, removeParams, safeReturnUrl };