(items, indenter)
| 1282 | * @returns {string} result |
| 1283 | */ |
| 1284 | const joinExplicitNewLine = (items, indenter) => { |
| 1285 | let firstInLine = true; |
| 1286 | let first = true; |
| 1287 | return items |
| 1288 | .map((item) => { |
| 1289 | if (!item || !item.content) return; |
| 1290 | let content = indent(item.content, first ? "" : indenter, !firstInLine); |
| 1291 | if (firstInLine) { |
| 1292 | content = content.replace(/^\n+/, ""); |
| 1293 | } |
| 1294 | if (!content) return; |
| 1295 | first = false; |
| 1296 | const noJoiner = firstInLine || content.startsWith("\n"); |
| 1297 | firstInLine = content.endsWith("\n"); |
| 1298 | return noJoiner ? content : ` ${content}`; |
| 1299 | }) |
| 1300 | .filter(Boolean) |
| 1301 | .join("") |
| 1302 | .trim(); |
| 1303 | }; |
| 1304 | |
| 1305 | /** |
| 1306 | * Returns joiner. |
no test coverage detected