MCPcopy Create free account
hub / github.com/massCodeIO/massCode / getDescription

Function getDescription

src/main/import/snippets/snippetsLab.ts:137–159  ·  view source on GitHub ↗
(record: SnippetsLabRecord)

Source from the content-addressed store, hash-verified

135}
136
137function 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
161export function parseSnippetsLabFiles(
162 files: ImportFile[],

Callers 1

parseSnippetsLabFilesFunction · 0.70

Calls 3

uniqueStringsFunction · 0.90
getRecordArrayFunction · 0.85
readStringFunction · 0.70

Tested by

no test coverage detected