1
2
3
4
5
6
7
8
export const objectToCsv = ((data: Object[]) => {
const headerRow = Object.keys(data[0]).join() + "\n";
let bodyRows = "";
data.forEach((element) => {
bodyRows += (Object.values(element).join() + "\n").toString();
});
return headerRow + bodyRows;
});