feat(core): initial

This commit is contained in:
2018-05-10 19:47:14 +02:00
commit dff335a6fb
15 changed files with 1146 additions and 0 deletions

3
test/sample.csv Normal file
View File

@ -0,0 +1,3 @@
Header 1;Header 2; Header3
row1data1; row1data2; row1data3
row2data1; row2data2; row2data3
1 Header 1 Header 2 Header3
2 row1data1 row1data2 row1data3
3 row2data1 row2data2 row2data3

21
test/test.ts Normal file
View File

@ -0,0 +1,21 @@
// tslint:disable-next-line:no-implicit-dependencies
import { expect, tap } from 'tapbundle';
import * as smartcsv from '../ts/index';
// tslint:disable-next-line:no-implicit-dependencies
import * as smartfile from 'smartfile';
let fileString: string;
let testCsv: smartcsv.Csv;
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});
const result = await testCsv.exportAsObject();
console.log(result);
});
tap.start();