MCPcopy Create free account
hub / github.com/chhoumann/quickadd / normalizeTemplateFolderPaths

Function normalizeTemplateFolderPaths

src/utils/templateFolderUtils.ts:47–59  ·  view source on GitHub ↗
(paths: unknown)

Source from the content-addressed store, hash-verified

45 * both the suggestion query and the package-import default so they never desync.
46 */
47export function normalizeTemplateFolderPaths(paths: unknown): string[] {
48 if (!Array.isArray(paths)) return [];
49 const seen = new Set<string>();
50 const normalized: string[] = [];
51 for (const path of paths) {
52 if (typeof path !== "string") continue;
53 const folder = path.trim().replace(/^\/+/, "").replace(/\/+$/, "");
54 if (!folder || seen.has(folder)) continue;
55 seen.add(folder);
56 normalized.push(folder);
57 }
58 return normalized;
59}
60
61/**
62 * Whether a file path lives within one of the (already normalized) template

Calls 2

addMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected