(paths: unknown)
| 45 | * both the suggestion query and the package-import default so they never desync. |
| 46 | */ |
| 47 | export 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 |
no test coverage detected