(gist: GitHubGistResponse, files: GitHubGistFile[])
| 48 | } |
| 49 | |
| 50 | function 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 | |
| 66 | function getGistFiles(gist: GitHubGistResponse): GitHubGistFile[] { |
| 67 | if ( |
no test coverage detected