MCPcopy Index your code
hub / github.com/massCodeIO/massCode / getLanguage

Function getLanguage

src/main/import/snippets/githubGists.ts:37–48  ·  view source on GitHub ↗
(file: GitHubGistFile)

Source from the content-addressed store, hash-verified

35}
36
37function getLanguage(file: GitHubGistFile): string {
38 if (typeof file.language === 'string' && file.language.trim()) {
39 return file.language.trim().toLowerCase().replace(/\s+/g, '_')
40 }
41
42 if (typeof file.filename !== 'string') {
43 return 'plain_text'
44 }
45
46 const extension = path.extname(file.filename).slice(1)
47 return extension || 'plain_text'
48}
49
50function getSnippetName(gist: GitHubGistResponse, files: GitHubGistFile[]) {
51 if (typeof gist.description === 'string' && gist.description.trim()) {

Callers 1

parseGitHubGistResponseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected