MCPcopy Index your code
hub / github.com/microsoft/SandDance / conditionalHeader

Function conditionalHeader

packages/sanddance/src/headers.ts:13–21  ·  view source on GitHub ↗
(condition: boolean, element: HTMLElement, header: string)

Source from the content-addressed store, hash-verified

11}
12
13function conditionalHeader(condition: boolean, element: HTMLElement, header: string) {
14 const existing = existingHeader(element, header);
15 if (condition && !existing) {
16 addHeader(element, header);
17 }
18 if (!condition && existing) {
19 existing.remove();
20 }
21}
22
23function addHeader(element: HTMLElement, header: string) {
24 const h = document.createElement('h4');

Callers 1

ensureHeadersFunction · 0.70

Calls 3

existingHeaderFunction · 0.70
addHeaderFunction · 0.70
removeMethod · 0.45

Tested by

no test coverage detected