/** * Trims all string values in an object while preserving the object's structure */ export const trimObjectValues = (obj: T): T => { return Object.keys(obj).reduce((acc, key) => { const value = obj[key as keyof T]; acc[key as keyof T] = ( typeof value === "string" ? value.trim() : value ) as T[keyof T]; return acc; }, {} as T); };