10 lines
392 B
TypeScript
10 lines
392 B
TypeScript
export const normalizePath = (value?: string | null): string =>
|
|||
|
|
(value || '').replace(/\\/g, '/').replace(/\/+$/g, '');
|
||
|
|
|
||
|
|
export const getProjectLabel = (path: string): string => {
|
||
|
|
const normalized = normalizePath(path);
|
||
|
|
if (!normalized) return '';
|
||
|
|
const segments = normalized.split('/').filter(Boolean);
|
||
|
|
return segments[segments.length - 1]?.replace(/[-_]/g, ' ') || normalized;
|
||
|
|
};
|