mirror of
https://github.com/lana-k/sqliteviz.git
synced 2025-12-06 10:08:52 +08:00
fix csv result when column names have spaces #59
This commit is contained in:
@@ -13,7 +13,7 @@ export default {
|
||||
result.columns = source.meta.fields.map(col => col.trim())
|
||||
result.values = source.data.map(row => {
|
||||
const resultRow = []
|
||||
result.columns.forEach(col => { resultRow.push(row[col]) })
|
||||
source.meta.fields.forEach(col => { resultRow.push(row[col]) })
|
||||
return resultRow
|
||||
})
|
||||
} else {
|
||||
|
||||
@@ -11,8 +11,8 @@ describe('csv.js', () => {
|
||||
it('getResult with fields', () => {
|
||||
const source = {
|
||||
data: [
|
||||
{ id: 1, name: 'foo' },
|
||||
{ id: 2, name: 'bar' }
|
||||
{ id: 1, 'name ': 'foo' },
|
||||
{ id: 2, 'name ': 'bar' }
|
||||
],
|
||||
meta: {
|
||||
fields: ['id', 'name ']
|
||||
|
||||
Reference in New Issue
Block a user