Replaced unmaintained dependency

This commit is contained in:
Alejandro Celaya
2022-03-31 20:18:05 +02:00
parent e2c8551baf
commit e875e05538
13 changed files with 189 additions and 65 deletions

View File

@@ -0,0 +1,12 @@
import csv from 'csvtojson';
import { parse } from 'json2csv';
export const csvToJson = <T>(csvContent: string) => new Promise<T[]>((resolve) => {
csv().fromString(csvContent).then(resolve);
});
export type CsvToJson = typeof csvToJson;
export const jsonToCsv = <T>(data: T[]): string => parse(data);
export type JsonToCsv = typeof jsonToCsv;