export const toCamel = (obj: any): any => { if (Array.isArray(obj)) return obj.map(toCamel); if (obj && typeof obj === "object") { return Object.fromEntries( Object.entries(obj).map(([k, v]) => [ k.replace(/_([a-z])/g, (_, c) => c.toUpperCase()), toCamel(v), ]) ); } return obj; };