forked from romeovs/lcov-reporter-action
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathhtml.js
30 lines (26 loc) · 855 Bytes
/
html.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function tag(name) {
return function(...children) {
const props =
typeof children[0] === "object"
? Object.keys(children[0])
.map(key => ` ${key}='${children[0][key]}'`)
.join("")
: "";
const c =
typeof children[0] === "string" ? children : children.slice(1);
return `<${name}${props}>${c.join("")}</${name}>`;
};
}
export const details = tag("details");
export const summary = tag("summary");
export const tr = tag("tr");
export const td = tag("td");
export const th = tag("th");
export const b = tag("b");
export const table = tag("table");
export const tbody = tag("tbody");
export const a = tag("a");
export const span = tag("span");
export const fragment = function(...children) {
return children.join("");
};