buildTable() — react Function Reference
Architecture documentation for the buildTable() function in flags.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 2576d93e_e38d_cfd8_7496_1ad4ff081879["buildTable()"] 9707085b_16d7_ffa5_8026_16a476a1a065["flags.js"] 2576d93e_e38d_cfd8_7496_1ad4ff081879 -->|defined in| 9707085b_16d7_ffa5_8026_16a476a1a065 7bfec035_7585_b310_5ffc_37b14a24153e["values()"] 2576d93e_e38d_cfd8_7496_1ad4ff081879 -->|calls| 7bfec035_7585_b310_5ffc_37b14a24153e 040a96ea_7913_5630_d84e_f7e42bb3068d["argToHeader()"] 2576d93e_e38d_cfd8_7496_1ad4ff081879 -->|calls| 040a96ea_7913_5630_d84e_f7e42bb3068d style 2576d93e_e38d_cfd8_7496_1ad4ff081879 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
scripts/flags/flags.js lines 400–448
function buildTable(filterFn) {
const isDiff = argv.diff != null && argv.diff.length > 1;
const table = {};
const filteredFlags = filterFn
? allFlagsUniqueFlags.filter(filterFn)
: allFlagsUniqueFlags;
// eslint-disable-next-line no-for-of-loops/no-for-of-loops
for (const flag of filteredFlags) {
const values = FLAG_COLUMNS.reduce((acc, key) => {
acc[key] = FLAG_CONFIG[key](flag);
return acc;
}, {});
if (!isDiff) {
table[flag] = values;
continue;
}
const subset = argv.diff.map(argToHeader).reduce((acc, key) => {
if (key in values) {
acc[key] = values[key];
}
return acc;
}, {});
if (new Set(Object.values(subset)).size !== 1) {
table[flag] = subset;
}
}
// Sort the table
let sorted = table;
if (isDiff || argv.sort) {
const sortChannel = argToHeader(isDiff ? argv.diff[0] : argv.sort);
const sortBy =
sortChannel === 'flag'
? ([flagA], [flagB]) => {
return flagA.localeCompare(flagB);
}
: ([, rowA], [, rowB]) => {
return rowB[sortChannel]
.toString()
.localeCompare(rowA[sortChannel]);
};
sorted = Object.fromEntries(Object.entries(table).sort(sortBy));
}
return sorted;
}
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does buildTable() do?
buildTable() is a function in the react codebase, defined in scripts/flags/flags.js.
Where is buildTable() defined?
buildTable() is defined in scripts/flags/flags.js at line 400.
What does buildTable() call?
buildTable() calls 2 function(s): argToHeader, values.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free