Mitchell Magro 4f05061411 Fixed Build
2025-11-25 11:39:58 +01:00

26 lines
731 B
TypeScript

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const normalizeValue = (input: any): string => {
if (input == null) return "";
if (typeof input === "string" || typeof input === "number")
return String(input);
if (input?.value) return String(input.value);
if (input?.id) return String(input.id);
if (Array.isArray(input)) {
return input.map(normalizeValue).join(",");
}
return "";
};
// Default operator based on field and type
export const defaultOperatorForField = (
field: string,
type: string
): string => {
if (field === "Amount") return ">="; // numeric field
if (type === "text") return "LIKE"; // string/text search
return "=="; // everything else (select, etc.)
};