-
Notifications
You must be signed in to change notification settings - Fork 72
Add type casting to CSV fields #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
f5220bb
6125efa
524680c
4bc1a68
ba37f17
7cf7ae2
d628eff
2e728c8
0c21a32
dfbc006
e045a72
ceb547b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,6 +46,7 @@ | |
| key: key, | ||
| label: get(val, 'label', val), | ||
| required: get(val, 'required', true), | ||
| type: get(val, 'type', String), | ||
| }; | ||
| }); | ||
| } | ||
|
|
@@ -83,11 +84,12 @@ | |
| const buildMappedCsv = function () { | ||
| let newCsv = VueCsvImportData.fileHasHeaders ? VueCsvImportData.rawCsv : drop(VueCsvImportData.rawCsv); | ||
| let typeMap = VueCsvImportData.fields.reduce((a, f) => set(a, f.key, f.type ?? String), {}); | ||
Libertie marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| VueCsvImportData.value = map(newCsv, (row) => { | ||
| let newRow = {}; | ||
| forEach(VueCsvImportData.map, (column, field) => { | ||
| set(newRow, field, get(row, column)); | ||
| set(newRow, field, typeMap[field](get(row, column))); | ||
|
||
| }); | ||
| return newRow; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.