Files
HiveGrid-Wireframes/hivegrid-cloud/apps/web/app/utils/shared/SeparatorUtils.ts
T

28 lines
955 B
TypeScript

export type SeparatorFormatType = "Enter" | "Tab" | "," | ";" | " " | ".";
export const SeparatorFormats: { name: string; value: SeparatorFormatType; labelKey: string }[] = [
{ name: "Enter", value: "Enter", labelKey: "formats.separator.enter" },
{ name: "Tab", value: "Tab", labelKey: "formats.separator.tab" },
{ name: "Comma", value: ",", labelKey: "formats.separator.comma" },
{ name: "Semicolon", value: ";", labelKey: "formats.separator.semicolon" },
{ name: "Space", value: " ", labelKey: "formats.separator.space" },
{ name: "Dot", value: ".", labelKey: "formats.separator.dot" },
];
export function getSeparator(separator: string | undefined): SeparatorFormatType {
switch (separator) {
case "Enter":
return "Enter";
case "Tab":
return "Tab";
case ",":
return ",";
case ";":
return ";";
case " ":
return " ";
case ".":
return ".";
default:
return "Enter";
}
}