Files
better-auth/docs/lib/is-active.ts
Fuma Nama d20f9a763c chore: update to Fumadocs 15.7 (#4154)
Co-authored-by: KinfeMichael Tariku <65047246+Kinfe123@users.noreply.github.com>
Co-authored-by: Kinfe123 <kinfishtech@gmail.com>
2025-08-22 19:00:45 -07:00

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}/`));
}