(items)
| 7 | } |
| 8 | |
| 9 | function renderList(items) { |
| 10 | if (items.length === 0) { |
| 11 | return "<p>None.</p>"; |
| 12 | } |
| 13 | return `<ul>${items.map((item) => `<li>${escapeHtml(item)}</li>`).join("")}</ul>`; |
| 14 | } |
| 15 | |
| 16 | function renderOptionalList(items, emptyLabel = "None.") { |
| 17 | return renderList(Array.isArray(items) && items.length > 0 ? items : [emptyLabel]); |
no test coverage detected