(relativePath: string, prefixes: string[])
| 6 | // to mis-key agents whose home/parent segments coincidentally contained one of |
| 7 | // the prefix names (see #25713). |
| 8 | function stripPrefix(relativePath: string, prefixes: string[]) { |
| 9 | const normalized = relativePath.replaceAll("\\", "/") |
| 10 | for (const prefix of prefixes) { |
| 11 | if (normalized.startsWith(prefix)) return normalized.slice(prefix.length) |
| 12 | } |
| 13 | } |
| 14 | |
| 15 | export function configEntryNameFromPath(relativePath: string, prefixes: string[]) { |
| 16 | const candidate = stripPrefix(relativePath, prefixes) ?? path.basename(relativePath) |
no outgoing calls
no test coverage detected