MCPcopy Create free account
hub / github.com/nodejs/nodejs.org / tableSection

Function tableSection

apps/site/scripts/compare-size/index.mjs:62–72  ·  view source on GitHub ↗
(title, items, columns, icon)

Source from the content-addressed store, hash-verified

60 * Builds a collapsible table section
61 */
62const tableSection = (title, items, columns, icon) => {
63 if (!items.length) {
64 return '';
65 }
66 const header = `| ${columns.map(c => c.label).join(' | ')} |\n`;
67 const separator = `| ${columns.map(() => '---').join(' | ')} |\n`;
68 const rows = items
69 .map(item => `| ${columns.map(c => c.format(item)).join(' | ')} |`)
70 .join('\n');
71 return `<details>\n<summary>${icon} ${title} <strong>(${items.length})</strong></summary>\n\n${header}${separator}${rows}\n\n</details>\n\n`;
72};
73
74/**
75 * Compares old and new assets and returns a markdown report

Callers 1

reportDiffFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected