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

Function getArrayObjectCandidates

apps/json-format/table-utils.js:18–31  ·  view source on GitHub ↗
(input)

Source from the content-addressed store, hash-verified

16}
17
18function getArrayObjectCandidates(input) {
19 const candidates = [];
20 if (Array.isArray(input) && input.every(isPlainObject)) {
21 candidates.push({ path: '$', rows: input });
22 } else if (isPlainObject(input)) {
23 Object.keys(input).forEach((key) => {
24 const value = input[key];
25 if (Array.isArray(value) && value.length && value.every(isPlainObject)) {
26 candidates.push({ path: '$.' + key, rows: value });
27 }
28 });
29 }
30 return candidates;
31}
32
33function buildRowsFromObjects(rows) {
34 const columns = [];

Callers 1

buildTableViewDataFunction · 0.85

Calls 1

isPlainObjectFunction · 0.70

Tested by

no test coverage detected