(record: SnippetsLabRecord)
| 135 | } |
| 136 | |
| 137 | function getDescription(record: SnippetsLabRecord): string | null { |
| 138 | const descriptionParts: string[] = [] |
| 139 | const sourceUrl = readString(record, 'githubHTMLURL') |
| 140 | if (sourceUrl) { |
| 141 | descriptionParts.push(sourceUrl) |
| 142 | } |
| 143 | |
| 144 | const notes = getRecordArray(record, 'fragments') |
| 145 | .map((fragment) => { |
| 146 | const note = readString(fragment, 'note') |
| 147 | if (!note) { |
| 148 | return null |
| 149 | } |
| 150 | |
| 151 | const title = readString(fragment, 'title') |
| 152 | return title && title !== 'Fragment' ? `${title}:\n${note}` : note |
| 153 | }) |
| 154 | .filter((note): note is string => !!note) |
| 155 | |
| 156 | descriptionParts.push(...uniqueStrings(notes)) |
| 157 | |
| 158 | return descriptionParts.length ? descriptionParts.join('\n\n') : null |
| 159 | } |
| 160 | |
| 161 | export function parseSnippetsLabFiles( |
| 162 | files: ImportFile[], |
no test coverage detected