dtable-utils
Version:
dtable common utils
30 lines (26 loc) • 1.02 kB
JavaScript
import { getColumnType } from './core.js';
import { CellType } from '../constants/cell-type.js';
import { NUMERIC_COLUMNS_TYPES } from '../constants/column.js';
/**
* Check whether is numeric column:
* - column type is number, duration or rate etc.
* - column type is formula and result_type is number
* - column type is link/link_formula and array_type is number, duration or rate etc.
* @param {object} column e.g. { type, data }
* @returns true/false, bool
*/
var isNumericColumn = function isNumericColumn(column) {
return NUMERIC_COLUMNS_TYPES.includes(getColumnType(column));
};
/**
* Check whether is number column:
* - column type is number
* - column type is formula and result_type is number
* - column type is link/link_formula and array_type is number
* @param {object} column e.g. { type, data }
* @returns true/false, bool
*/
var isNumberColumn = function isNumberColumn(column) {
return getColumnType(column) === CellType.NUMBER;
};
export { isNumberColumn, isNumericColumn };