MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / normalizeExtKey

Function normalizeExtKey

src/project-config.ts:144–153  ·  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

142 * - anything containing a path separator.
143 */
144function normalizeExtKey(raw: string): string | null {
145 if (typeof raw !== 'string') return null;
146 let ext = raw.trim().toLowerCase();
147 if (!ext) return null;
148 if (!ext.startsWith('.')) ext = '.' + ext;
149 const body = ext.slice(1);
150 if (!body) return null;
151 if (body.includes('.') || body.includes('/') || body.includes('\\')) return null;
152 return ext;
153}
154
155/**
156 * 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