async function readJson(path) {
const res = await fetch(path);
if (!res.ok) {
return [];
}
return res.json();
}
function renderTable(containerId, headers, rows) {
const container = document.getElementById(containerId);
if (!container) return;
if (!rows.length) {
container.innerHTML = "
No entries yet.
";
return;
}
const head = headers.map((h) => `${h} | `).join("");
const body = rows.map((row) => `${row.map((c) => `| ${c} | `).join("")}
`).join("");
container.innerHTML = ``;
}
async function init() {
const contributors = await readJson("data/contributors.json");
const security = await readJson("data/security_hof.json");
const contributorRows = contributors.map((c) => [
`${c.login}`,
String(c.contributions),
]);
const securityRows = security.map((s) => [
s.name,
s.issue,
s.reported,
]);
renderTable("contributors", ["Contributor", "Commits"], contributorRows);
renderTable("security-hof", ["Researcher", "Issue", "Reported"], securityRows);
}
init();