export function createCsvFromObjects>(os: T[]): string { if (os.length == 0) { throw new Error(`Cannon create CSV from empty list. Given list must not be empty.`) } const firstResult = os[0] const keys = Object.keys(firstResult) const headers = keys.join(',') const rows = os.map(result => Object.values(result).join(',')) const csv = `${headers} ${rows.join('\n')} ` return csv }