MCPcopy
hub / github.com/colbymchenry/codegraph / normalizeExtKey

Function normalizeExtKey

src/project-config.ts:95–104  ·  view source on GitHub ↗

* Normalize a user-provided extension key to the `.ext` lowercase form used by * the built-in map. Returns null for keys that can never match a real file * extension (so the caller warns and skips): * - empty / just "." * - multi-part (".d.ts") — language detection keys off the FINAL extensi

(raw: string)

Source from the content-addressed store, hash-verified

93 * - anything containing a path separator.
94 */
95function normalizeExtKey(raw: string): string | null {
96 if (typeof raw !== 'string') return null;
97 let ext = raw.trim().toLowerCase();
98 if (!ext) return null;
99 if (!ext.startsWith('.')) ext = '.' + ext;
100 const body = ext.slice(1);
101 if (!body) return null;
102 if (body.includes('.') || body.includes('/') || body.includes('\\')) return null;
103 return ext;
104}
105
106/**
107 * Read + JSON-parse a `codegraph.json` once and return its validated view.

Callers 1

extractExtensionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected