MCPcopy Create free account
hub / github.com/zxlie/FeHelper / buildRowsFromObjects

Function buildRowsFromObjects

apps/json-format/table-utils.js:33–59  ·  view source on GitHub ↗
(rows)

Source from the content-addressed store, hash-verified

31}
32
33function 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
61function buildKeyValueRows(obj) {
62 return {

Callers 1

buildTableViewDataFunction · 0.85

Calls 3

toCellValueFunction · 0.85
hasMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected