From 4f459ebcd96748987733e3c6dbad5d25db43b7b4 Mon Sep 17 00:00:00 2001 From: Shun Miyazawa Date: Sun, 14 Jan 2024 06:55:35 +0000 Subject: [PATCH] Cell -> CellType --- src/CalcMethod.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/CalcMethod.ts b/src/CalcMethod.ts index 4184b20..633010b 100644 --- a/src/CalcMethod.ts +++ b/src/CalcMethod.ts @@ -24,7 +24,7 @@ export const MethodTypes = Object.values(MethodType); export type MethodType = (typeof MethodType)[keyof typeof MethodType]; -type Cell = 'row' | 'column'; +type CellType = 'row' | 'column'; type Pos = { row: number; column: number }; @@ -56,16 +56,16 @@ const convertToCalculableValues = (values: any[]): number[] => { return values.map((v) => convertToNumber(v)).filter((v) => v != null) as number[]; }; -const getTargetCells = (api: DataTableApi, cell: Cell, pos: Pos): any => { - if (cell === 'row') { +const getTargetCells = (api: DataTableApi, cellType: CellType, pos: Pos): any => { + if (cellType === 'row') { return api.row(pos.row).data(); } - if (cell === 'column') { + if (cellType === 'column') { return api.column(pos.column).data().toArray(); } }; -const createCalcMethod = (cell: Cell, calculator: (values: number[]) => number): CalcMethod['calcMethod'] => { +const createCalcMethod = (cell: CellType, calculator: (values: number[]) => number): CalcMethod['calcMethod'] => { return (api: DataTableApi, pos: Pos) => { const targetCells = getTargetCells(api, cell, pos); const calculableValues = convertToCalculableValues(targetCells);