import { KeyOf, List } from "@mantlebee/ts-core"; import { RelationCountCondition } from "./types"; export function setRelationCountValues( sourceColumnName: KeyOf, countCondition: RelationCountCondition, sourceRows: List, targetRows: List ): void { sourceRows.forEach((sourceRow) => { const count = targetRows.filter((targetRow) => countCondition(sourceRow, targetRow) ).length; sourceRow[sourceColumnName] = count as TSourceRow[KeyOf]; }); }