Skip to content

Commit

Permalink
fix: remove papase deps
Browse files Browse the repository at this point in the history
papase seems caused a dep issue.(bad version update control)
  • Loading branch information
ObservedObserver committed Jun 30, 2021
1 parent b3d0477 commit 93ad573
Show file tree
Hide file tree
Showing 4 changed files with 3,691 additions and 4,416 deletions.
5 changes: 2 additions & 3 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"@types/chroma-js": "^1.4.3",
"@types/jest": "^26.0.20",
"@types/node": "^12.19.12",
"@types/papaparse": "^5.0.1",
"@uifabric/icons": "^7.5.17",
"@uifabric/react-hooks": "^7.13.9",
"ali-react-table": "^2.3.1",
Expand All @@ -28,7 +27,6 @@
"mocha": "^6.2.0",
"office-ui-fabric-core": "^11.0.0",
"office-ui-fabric-react": "^7.155.3",
"papaparse": "^5.1.0",
"react": "^17.0.1",
"react-app-rewired": "^2.1.5",
"react-beautiful-dnd": "^13.0.0",
Expand All @@ -44,7 +42,8 @@
"vega-lite": "^4.17.0",
"visual-insights": "^0.5.5",
"web-vitals": "^0.2.4",
"worker-loader": "^3.0.7"
"worker-loader": "^3.0.7",
"yarn": "^1.19.0"
},
"devDependencies": {
"@types/react": "^17.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/pages/dataSource/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export async function loadDataFile(file: File, sampleMethod: SampleKey, sampleSi
let rawData: Record[] = []

if (file.type === 'text/csv' || file.type === 'application/vnd.ms-excel') {
rawData = await FileLoader.csvLoader(file)
rawData = []
if (sampleMethod === SampleKey.reservoir) {
rawData = (await FileReader.csvReader({
file,
Expand Down
25 changes: 1 addition & 24 deletions packages/frontend/src/utils/fileParser.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,4 @@
import { Record, DataSource } from '../global';
import Papa from 'papaparse';

export function csvLoader (file: File) {
return new Promise<DataSource>((resolve, reject) => {
Papa.parse(file, {
complete (results, file) {
let data: string[][] = results.data;
let fields: string[] = data[0];
let rawData = data.slice(1).map(row => {
let record: Record = {};
fields.forEach((field, index) => {
record[field] = row[index]
})
return record
})
resolve(rawData)
},
error (error, file) {
reject(error)
}
})
})
}
import { DataSource } from '../global';

export function jsonLoader (file: File): Promise<DataSource> {
return new Promise((resolve, reject) => {
Expand Down
Loading

0 comments on commit 93ad573

Please sign in to comment.