(text: string, indent = "", wrap = true)
| 301 | } |
| 302 | |
| 303 | function goCommentLines(text: string, indent = "", wrap = true): string[] { |
| 304 | const prefix = `${indent}//`; |
| 305 | const lines: string[] = []; |
| 306 | |
| 307 | for (const paragraph of text.split(/\r?\n/)) { |
| 308 | const trimmed = paragraph.trim(); |
| 309 | if (trimmed.length === 0) { |
| 310 | lines.push(prefix); |
| 311 | continue; |
| 312 | } |
| 313 | const commentLines = wrap |
| 314 | ? wrapGoCommentText(trimmed).split("\n").map((wrappedLine: string) => wrappedLine.trim()) |
| 315 | : [trimmed]; |
| 316 | for (const line of commentLines) { |
| 317 | lines.push(`${prefix} ${line}`); |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | return lines; |
| 322 | } |
| 323 | |
| 324 | function wrapGeneratedGoComments(code: string): string { |
| 325 | return code |
no test coverage detected
searching dependent graphs…