export function flatten( obj: Record, prefix = "" ): Record { return Object.keys(obj).reduce((acc, key) => { const value = obj[key]; const newKey = prefix ? `${prefix}.${key}` : key; if ( typeof value === "object" && value !== null && !Array.isArray(value) ) { Object.assign(acc, flatten(value, newKey)); } else { acc[newKey] = value; } return acc; }, {} as Record); }