MCPcopy Create free account
hub / github.com/MiniMax-AI/OpenRoom / normalizePath

Function normalizePath

apps/webuiapps/src/lib/path.ts:29–38  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

27 * - Remove trailing slash (except root)
28 */
29export const normalizePath = (path: string): string => {
30 let normalized = path.replace(/\/+/g, '/');
31 if (!normalized.startsWith('/')) {
32 normalized = '/' + normalized;
33 }
34 if (normalized.length > 1 && normalized.endsWith('/')) {
35 normalized = normalized.slice(0, -1);
36 }
37 return normalized;
38};
39
40/**
41 * Extract directory path from full path (without leading slash)

Callers 15

listFilesFunction · 0.90
readFileFunction · 0.90
writeFileFunction · 0.90
deleteFileFunction · 0.90
getByPathMethod · 0.90
existsMethod · 0.90
addNodeMethod · 0.90
moveNodeMethod · 0.90
normalizeCloudNodesMethod · 0.90
toTextFileFunction · 0.90
listFilesFunction · 0.90
readFileFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected