MCPcopy Create free account
hub / github.com/github/awesome-copilot / formatDisplayName

Function formatDisplayName

eng/generate-website-data.mjs:72–98  ·  view source on GitHub ↗

* Convert kebab/snake names into readable titles.

(value)

Source from the content-addressed store, hash-verified

70 * Convert kebab/snake names into readable titles.
71 */
72function formatDisplayName(value) {
73 const acronymMap = new Map([
74 ["ai", "AI"],
75 ["api", "API"],
76 ["cli", "CLI"],
77 ["css", "CSS"],
78 ["html", "HTML"],
79 ["json", "JSON"],
80 ["llm", "LLM"],
81 ["mcp", "MCP"],
82 ["ui", "UI"],
83 ["ux", "UX"],
84 ["vscode", "VS Code"],
85 ]);
86
87 return value
88 .split(/[-_]+/)
89 .filter(Boolean)
90 .map((part) => {
91 const lower = part.toLowerCase();
92 if (acronymMap.has(lower)) {
93 return acronymMap.get(lower);
94 }
95 return part.charAt(0).toUpperCase() + part.slice(1).toLowerCase();
96 })
97 .join(" ");
98}
99
100function normalizeText(value, fallback = "") {
101 return typeof value === "string" ? value.trim() : fallback;

Callers 1

generateCanvasManifestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected