MCPcopy Create free account
hub / github.com/BuilderIO/framework-benchmarks / getTable

Function getTable

src/helpers/get-table.ts:4–30  ·  view source on GitHub ↗
(results: Record<string, SimpleReport>)

Source from the content-addressed store, hash-verified

2import { sortBy } from './sort-by.js';
3
4export function getTable(results: Record<string, SimpleReport>) {
5 const table = Object.keys(results)
6 // Add the framework name to the object
7 .map((framework) => ({
8 name: framework,
9 ...results[framework],
10 }))
11 // Only include successful results (failed results have undefined values)
12 .filter((item) => typeof item.jsKb === 'number')
13 // Rank by tti
14 .sort(sortBy('ttiNumber'))
15 // Pick the display values
16 .map((item) => ({
17 name: item.name,
18 TTI: item.ttiDisplay,
19 FCP: item.fcpDisplay,
20 LCP: item.lcpDisplay,
21 TBT: item.tbtDisplay,
22 Score: item.score,
23 'Eager JS KiB': item.jsKb,
24 'Total KiB': item.totalKb,
25 // Getting really weird results for LCP, commenting out for now
26 // LCP: item.lcpDisplay,
27 }));
28
29 return table;
30}

Callers

nothing calls this directly

Calls 1

sortByFunction · 0.70

Tested by

no test coverage detected