UNPKG

rollun-ts-utils

Version:
16 lines (15 loc) 510 B
/** * Data to CSV * Example: * const data = [{id: '1', field: '2'}, {id: '3', field: '4'}] * dataToCSV(data) -> 'id,field\n"1","2"\n"3","4"\n' */ export declare type CSVValue = string | number | any; export declare type CSVRowObject = { [key: string]: CSVValue; }; export declare type CSVRowArray = Array<CSVValue>; export declare type CSVRow = CSVRowObject | CSVRowArray; export declare type CSVData = Array<CSVRow>; declare function arrayToCSV(flatData: CSVData): string; export default arrayToCSV;