1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16import { ROUTES, RouteType } from '../constants/routes'; export const routeFromPath = (path: string): RouteType | null => { const route: RouteType | undefined = Object.values<RouteType>(ROUTES) .find((currentRoute: RouteType) => currentRoute.path === path); return route || null; }; export const routeTitleFromPath = (path: string): string | null => { const route: RouteType | null = routeFromPath(path); if (route) { return route.title; } return null; };