MCPcopy Create free account
hub / github.com/arctic-cli/interface / dottedSuffixesDesc

Function dottedSuffixesDesc

packages/ui/src/components/file-icon.tsx:552–560  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

550}
551
552const 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
562export function chooseIconName(path: string, type: "directory" | "file", expanded: boolean): IconName {
563 const base = basenameOf(path)

Callers 1

chooseIconNameFunction · 0.85

Calls 2

pushMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected