Migrated from react-scripts and webpack to vite

This commit is contained in:
Alejandro Celaya
2022-12-24 10:18:26 +01:00
parent 35fcd20123
commit 52f556eb2e
10 changed files with 1525 additions and 19879 deletions

View File

@@ -1,5 +1,6 @@
import csv from 'csvtojson';
import { parse } from 'json2csv';
// @ts-expect-error gfgf
import { Parser } from '@json2csv/plainjs';
export const csvToJson = <T>(csvContent: string) => new Promise<T[]>((resolve) => {
csv().fromString(csvContent).then(resolve);
@@ -7,6 +8,8 @@ export const csvToJson = <T>(csvContent: string) => new Promise<T[]>((resolve) =
export type CsvToJson = typeof csvToJson;
export const jsonToCsv = <T>(data: T[]): string => parse(data);
const jsonParser = new Parser(); // TODO This accepts options if needed
export const jsonToCsv = <T>(data: T[]): string => jsonParser.parse(data);
export type JsonToCsv = typeof jsonToCsv;