khata compliant with new react-openapi

This commit is contained in:
2026-06-18 23:20:57 +05:30
parent cbac57dc36
commit 12e5f113b8
12 changed files with 103 additions and 113 deletions

View File

@@ -1,4 +1,11 @@
function getNested(obj: any, path: string): any {
return path.split(".").reduce((o, k) => o?.[k], obj);
}
export function applyDisplayFormat(item: any, format: string): string {
if (!item || typeof item !== "object") return String(item ?? "");
return format.replace(/\{(\w+)\}/g, (_, key) => String(item[key] ?? ""));
return format.replace(/\{([\w.]+)\}/g, (_, key) => {
const val = getNested(item, key);
return val != null ? String(val) : "";
});
}