refactor(plugin-data-spreadsheet-new): CB-1047

This commit is contained in:
Naumov Alexey
2021-07-07 19:02:37 +03:00
parent 19c86a1c6b
commit aa1305d2ce
@@ -10,7 +10,10 @@ import type { SqlResultColumn } from '@cloudbeaver/core-sdk';
import type { IResultSetValue } from '@cloudbeaver/plugin-data-viewer';
export function isBooleanFormatter(cellValue: IResultSetValue, column: SqlResultColumn): boolean {
return column?.dataKind?.toLowerCase() === 'boolean' && (
(typeof cellValue === 'boolean' || (typeof cellValue === 'string' && (cellValue.toLowerCase() === 'false' || cellValue.toLowerCase() === 'true'))) || cellValue === null
);
return column?.dataKind?.toLowerCase() === 'boolean'
&& (
typeof cellValue === 'boolean'
|| cellValue === null
|| (typeof cellValue === 'string' && ['false', 'true'].includes(cellValue.toLowerCase()))
);
}