MCPcopy Create free account
hub / github.com/Nutlope/llamacoder / getExtensionForLanguage

Function getExtensionForLanguage

lib/utils.ts:203–226  ·  view source on GitHub ↗
(language: string)

Source from the content-addressed store, hash-verified

201}
202
203export function getExtensionForLanguage(language: string): string {
204 const extensions: Record<string, string> = {
205 javascript: "js",
206 js: "js",
207 typescript: "tsx",
208 ts: "ts",
209 tsx: "tsx",
210 jsx: "jsx",
211 python: "py",
212 py: "py",
213 html: "html",
214 css: "css",
215 json: "json",
216 markdown: "md",
217 md: "md",
218 sql: "sql",
219 bash: "sh",
220 sh: "sh",
221 yaml: "yaml",
222 yml: "yml",
223 };
224
225 return extensions[language.toLowerCase()] || "txt";
226}
227
228export function getLanguageOfFile(filePath: string): string {
229 const extension = filePath.split(".").pop()?.toLowerCase();

Callers 3

parseTagFunction · 0.90
parseFenceTagFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected