import { RouteObject } from 'react-router-dom' import { routes as r } from '../routes' export const hasOutlet = (parentPath: string, pathname: string, routes: RouteObject[] = r): boolean => { const matched = routes.find(a => a.path === parentPath)?.children?.map(a => `${parentPath}/${a.path}`) || [] return matched.some(a => new RegExp(`${a}`).test(pathname)) }