MCPcopy Create free account
hub / github.com/RiotGames/developer-relations / json2table

Function json2table

sample_apps/rso_sample_apps/nodejs/index.js:109–146  ·  view source on GitHub ↗
(json)

Source from the content-addressed store, hash-verified

107}
108
109function json2table(json) {
110 const style = `
111 <style type="text/css">
112 .tg {border-collapse:collapse;border-spacing:0;}
113 .tg td{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;
114 overflow:hidden;padding:10px 5px;word-break:normal;}
115 .tg th{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;
116 font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;}
117 .tg .tg-0lax{text-align:left;vertical-align:top}
118 </style>`;
119
120 var html = `
121 <table class="tg">
122 <thead>
123 <tr>
124 <th class="tg-0lax">key</th>
125 <th class="tg-0lax">value</th>
126 </tr>
127 </thead>
128
129 <tbody>`;
130
131 for (const [key, value] of Object.entries(json)) {
132 html += `
133 <tr>
134 <td class="tg-0lax">${key}</td>
135 <td class="tg-0lax">${value}<br></td>
136 </tr>`
137 }
138
139 html += `
140 </tbody>
141 </table>
142 `
143
144 return style + html;
145
146}
147app.listen(port, () => console.log(`Example app listening on post ${port}!`));

Callers 1

index.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected