(name: string)
| 550 | } |
| 551 | |
| 552 | const dottedSuffixesDesc = (name: string) => { |
| 553 | const n = name.toLowerCase() |
| 554 | const idxs: number[] = [] |
| 555 | for (let i = 0; i < n.length; i++) if (n[i] === ".") idxs.push(i) |
| 556 | const out = new Set<string>() |
| 557 | out.add(n) // allow exact whole-name "extensions" like "dockerfile" |
| 558 | for (const i of idxs) if (i + 1 < n.length) out.add(n.slice(i + 1)) |
| 559 | return Array.from(out).sort((a, b) => b.length - a.length) // longest first |
| 560 | } |
| 561 | |
| 562 | export function chooseIconName(path: string, type: "directory" | "file", expanded: boolean): IconName { |
| 563 | const base = basenameOf(path) |
no test coverage detected