mirror of
https://github.com/lynchmarkHQ/lynchmark.com.git
synced 2026-10-18 17:57:55 +00:00
Docs: Update Gemini benchmark results
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
const processCSV = async (csvString, config) => {
|
||||
const [{ csvParse }, { rollups, sum }] = await Promise.all([
|
||||
import('https://esm.sh/d3-dsv'),
|
||||
import('https://esm.sh/d3-array')
|
||||
]);
|
||||
|
||||
const { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op } = config;
|
||||
const getVal = d => +d[ac] || 0;
|
||||
|
||||
return rollups(
|
||||
csvParse(csvString).filter(d => d[fc] == fv),
|
||||
g => op === 'count' ? g.length : (op === 'avg' ? sum(g, getVal) / g.length : sum(g, getVal)),
|
||||
d => d[gb]
|
||||
).map(([k, v]) => ({ [gb]: k, result: v }));
|
||||
};
|
||||
export default processCSV;
|
||||
Reference in New Issue
Block a user