Files
discord.js/apps/website/src/hooks/useCurrentPathMeta.ts
2023-03-23 22:17:41 +01:00

20 lines
287 B
TypeScript

'use client';
import { usePathname } from 'next/navigation';
export function useCurrentPathMeta() {
const pathname = usePathname();
if (!pathname) {
return {};
}
const [, , , packageName, version, item] = pathname.split('/');
return {
packageName,
version,
item,
};
}