MCPcopy Create free account
hub / github.com/Cosmian/kms / getDomainSections

Function getDomainSections

documentation/docs/javascripts/log_filter.js:76–88  ·  view source on GitHub ↗
(content)

Source from the content-addressed store, hash-verified

74// Returns [{heading: h2El, tables: [tableEl, ...]}, ...]
75
76function getDomainSections(content) {
77 const sections = [];
78 let current = null;
79 content.querySelectorAll("h2, table").forEach((el) => {
80 if (el.tagName === "H2") {
81 current = el.textContent.includes("Domain:") ? { heading: el, tables: [] } : null;
82 if (current) sections.push(current);
83 } else if (el.tagName === "TABLE" && current) {
84 if (el.querySelectorAll("thead th").length >= 5) current.tables.push(el);
85 }
86 });
87 return sections;
88}
89
90// ── Controls builder (one per domain) ────────────────────────────────────
91

Callers 1

initPageFunction · 0.85

Calls 3

forEachMethod · 0.45
includesMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected