feat(parser): now handles comma and semicolon seperated csv strings

This commit is contained in:
2018-05-11 00:53:27 +02:00
parent 2e23d959da
commit 0de7b75dca
8 changed files with 130 additions and 34 deletions

View File

@ -8,12 +8,12 @@ import * as smartfile from 'smartfile';
let fileString: string;
let testCsv: smartcsv.Csv;
tap.test('should read a file', async (tools) => {
tap.test('should read a file', async tools => {
fileString = smartfile.fs.toStringSync('./test/sample.csv');
});
tap.test('should create a valid csv', async () => {
testCsv = await smartcsv.Csv.createCsvFromString(fileString, {headers: true});
testCsv = await smartcsv.Csv.createCsvFromString(fileString, { headers: true });
const result = await testCsv.exportAsObject();
console.log(result);
});