MCPcopy Create free account
hub / github.com/BuilderIO/framework-benchmarks / renderTable

Function renderTable

frameworks/lit/docs-src/api.11ty.cjs:97–125  ·  view source on GitHub ↗
(name, properties, data)

Source from the content-addressed store, hash-verified

95 * `data`.
96 */
97const renderTable = (name, properties, data) => {
98 if (data === undefined || data.length === 0) {
99 return '';
100 }
101 return `
102 ${name ? `<h3>${name}</h3>` : ''}
103 <table>
104 <tr>
105 ${properties
106 .map(
107 (p) =>
108 `<th>${capitalize(
109 (Array.isArray(p) ? p[0] : p).split('.')[0]
110 )}</th>`
111 )
112 .join('')}
113 </tr>
114 ${data
115 .map(
116 (i) => `
117 <tr>
118 ${properties.map((p) => `<td>${get(i, p)}</td>`).join('')}
119 </tr>
120 `
121 )
122 .join('')}
123 </table>
124 `;
125};
126
127const capitalize = (s) => s[0].toUpperCase() + s.substring(1);

Callers 1

renderMethod · 0.85

Calls 2

capitalizeFunction · 0.85
getFunction · 0.85

Tested by

no test coverage detected