MCPcopy Index your code
hub / github.com/callumalpass/tasknotes / normalizeRelativeFolderPath

Function normalizeRelativeFolderPath

src/utils/folderTemplateProcessor.ts:87–107  ·  view source on GitHub ↗
(folderPath: string)

Source from the content-addressed store, hash-verified

85}
86
87function normalizeRelativeFolderPath(folderPath: string): string {
88 const slashNormalizedPath = folderPath.replace(/\\/g, "/");
89 const preserveTrailingSlash = slashNormalizedPath.endsWith("/");
90 const normalizedSegments: string[] = [];
91
92 for (const segment of slashNormalizedPath.split("/")) {
93 if (!segment || segment === ".") {
94 continue;
95 }
96
97 if (segment === "..") {
98 normalizedSegments.pop();
99 continue;
100 }
101
102 normalizedSegments.push(segment);
103 }
104
105 const normalizedPath = normalizedSegments.join("/");
106 return preserveTrailingSlash && normalizedPath ? `${normalizedPath}/` : normalizedPath;
107}
108
109function stripMarkdownExtension(path: string): string {
110 return path.replace(/\.md$/i, "");

Callers 1

processFolderTemplateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected