import { split } from '@ywfe/utils'; export const getPathAndUrl = (path: string, parentPath = '', moduleId = '', moduleName = '', isDefault = false): Record => { if(!parentPath){ return { path, url: path }; } const parentPaths = split('/', parentPath); if(parentPaths.length === 3 && parentPaths[2].indexOf('?') >= 0 && moduleId && moduleName){ const menu = path.replace(/\//g, '_'); const newUrl = `/${moduleName}/${moduleId}${isDefault ? '' : `/${menu}`}`; return { path, url: newUrl, menu }; } return { path: `${parentPath}${path}`, url: `${parentPath}${path}`, }; }