mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-06 12:27:44 +00:00
Co-authored-by: KinfeMichael Tariku <65047246+Kinfe123@users.noreply.github.com> Co-authored-by: Kinfe123 <kinfishtech@gmail.com>
11 lines
274 B
TypeScript
11 lines
274 B
TypeScript
export function isActive(
|
|
url: string,
|
|
pathname: string,
|
|
nested = true,
|
|
): boolean {
|
|
if (url.endsWith("/")) url = url.slice(0, -1);
|
|
if (pathname.endsWith("/")) pathname = pathname.slice(0, -1);
|
|
|
|
return url === pathname || (nested && pathname.startsWith(`${url}/`));
|
|
}
|