name:
src/main/js/spreadsheet/ExcelDataType.ts
-rw-r--r--
569
1import { Computed } from "../models/common/Types";
2import { AbstractStandardError } from "../common/errors/StandardError";
3
4// b Boolean, n Number, e Error, s String, d Date, z Empty
5export type ExcelDataType = "b" | "n" | "e" | "s" | "d" | "z";
6
7export function excelDataTypeFromActualType(value: Computed) {
8 if (typeof value === "boolean") {
9 return "b";
10 } else if (typeof value === "number") {
11 return "n";
12 } else if (typeof value === "string") {
13 return "s";
14 } else if (value instanceof AbstractStandardError) {
15 return "e";
16 }
17 return "z";
18}