(rows)
| 31 | } |
| 32 | |
| 33 | function buildRowsFromObjects(rows) { |
| 34 | const columns = []; |
| 35 | const columnSeen = new Set(); |
| 36 | rows.forEach((row) => { |
| 37 | Object.keys(row).forEach((key) => { |
| 38 | if (!columnSeen.has(key)) { |
| 39 | columnSeen.add(key); |
| 40 | columns.push(key); |
| 41 | } |
| 42 | }); |
| 43 | }); |
| 44 | |
| 45 | return { |
| 46 | mode: 'grid', |
| 47 | columns, |
| 48 | rows: rows.map((row, index) => { |
| 49 | const cells = {}; |
| 50 | columns.forEach((column) => { |
| 51 | cells[column] = toCellValue(row[column]); |
| 52 | }); |
| 53 | return { |
| 54 | id: index, |
| 55 | cells |
| 56 | }; |
| 57 | }) |
| 58 | }; |
| 59 | } |
| 60 | |
| 61 | function buildKeyValueRows(obj) { |
| 62 | return { |
no test coverage detected