MCPcopy Create free account
hub / github.com/HelloCSV/HelloCSV / recalculateCalculatedColumns

Function recalculateCalculatedColumns

src/importer/reducer.tsx:22–42  ·  view source on GitHub ↗
(
  row: SheetRow,
  payload: CellChangedPayload,
  state: ImporterState
)

Source from the content-addressed store, hash-verified

20import { buildInitialState, buildState } from './state';
21
22function recalculateCalculatedColumns(
23 row: SheetRow,
24 payload: CellChangedPayload,
25 state: ImporterState
26): SheetRow {
27 const sheetDefinition = state.sheetDefinitions.find(
28 (s) => s.id === payload.sheetId
29 );
30
31 if (sheetDefinition != null) {
32 const calculatedColumns = sheetDefinition.columns.filter(
33 (column) => column.type === 'calculated'
34 );
35
36 calculatedColumns.forEach((column) => {
37 row[column.id] = column.typeArguments.getValue(row);
38 });
39 }
40
41 return row;
42}
43
44export const reducer = (
45 state: ImporterState,

Callers 1

reducerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected