UNPKG

@1771technologies/lytenyte-pro

Version:

Blazingly fast headless React data grid with 100s of features.

14 lines (13 loc) 468 B
import {} from "../../+types.js"; export function createAggModel(model, columns, separator) { const aggFunToId = new Map(model.values.map((c) => [c.field, c.aggFn])); const aggModel = columns .map((c) => { const aggId = c.id.split(separator).at(-1); if (!aggFunToId.has(aggId)) return null; return [c.id, { fn: aggFunToId.get(aggId) }]; }) .filter((c) => !!c); return Object.fromEntries(aggModel); }