mirror of
https://github.com/lynchmarkHQ/lynchmark.com.git
synced 2026-10-19 10:14:51 +00:00
Docs: Update Gemini benchmark results
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
export const processCSV = async (csv, { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op }) => {
|
||||
const [{ parse }, { groupBy, map }] = await Promise.all([
|
||||
import('https://esm.sh/papaparse@5.4.1'),
|
||||
import('https://esm.sh/lodash-es@4.17.21')
|
||||
]);
|
||||
|
||||
return map(groupBy(
|
||||
parse(csv, { header: true, skipEmptyLines: true }).data.filter(r => r[fc] == fv),
|
||||
gb
|
||||
), (rows, key) => {
|
||||
const sum = rows.reduce((a, r) => a + (+r[ac] || 0), 0);
|
||||
return {
|
||||
[gb]: key,
|
||||
result: op === 'count' ? rows.length : op === 'avg' ? sum / rows.length : sum
|
||||
};
|
||||
});
|
||||
};
|
||||
export default processCSV;
|
||||
Reference in New Issue
Block a user