Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 139x 139x 139x 1x 1x 1x 337x 337x 337x 337x 337x 337x 337x 335x 337x 2x 2x 335x 337x 337x | import { isNil } from 'lodash-es';
import { type RecordContent } from '@amalia/data-capture/connectors/types';
import { isCurrencyValue } from '@amalia/kernel/monetary/types';
interface TableSlice {
min: number;
max: number;
percent: number;
}
export const getTableSlice = (element: number[]): TableSlice => ({
min: element[0],
max: element[1],
percent: element[2],
});
export const getRowFieldAmount = (row: RecordContent, field: string): number => {
const value = row[field];
const fieldValue = isCurrencyValue(value) ? value.value : value;
if (
isNil(fieldValue) ||
Number.isNaN(+fieldValue) ||
(typeof fieldValue !== 'number' && typeof fieldValue !== 'string')
) {
throw new Error(`${field} value is not a number`);
}
return typeof fieldValue === 'string' ? Number.parseFloat(fieldValue) : fieldValue;
};
|