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

Function getSnippetName

src/main/import/snippets/githubGists.ts:50–64  ·  view source on GitHub ↗
(gist: GitHubGistResponse, files: GitHubGistFile[])

Source from the content-addressed store, hash-verified

48}
49
50function getSnippetName(gist: GitHubGistResponse, files: GitHubGistFile[]) {
51 if (typeof gist.description === 'string' && gist.description.trim()) {
52 return normalizeImportEntryName(gist.description, 'GitHub Gist')
53 }
54
55 const firstFile = files.find(file => typeof file.filename === 'string')
56 if (typeof firstFile?.filename === 'string') {
57 return normalizeImportEntryName(
58 path.basename(firstFile.filename, path.extname(firstFile.filename)),
59 'GitHub Gist',
60 )
61 }
62
63 return 'GitHub Gist'
64}
65
66function getGistFiles(gist: GitHubGistResponse): GitHubGistFile[] {
67 if (

Callers 1

parseGitHubGistResponseFunction · 0.85

Calls 1

normalizeImportEntryNameFunction · 0.90

Tested by

no test coverage detected