@ -19,6 +19,7 @@
"@toast-ui/vue-editor": "^1.1.1",
"codemirror": "^5.48.2",
"nuxt": "^2.0.0",
"papaparse": "^5.0.2",
"tui-editor": "^1.4.5",
"vuetify": "^2.0.2"
},
@ -0,0 +1,9 @@
import Papa from 'papaparse'
class CSVParser {
parse(text, options = { header: true }) {
return Papa.parse(text, options)
}
export default CSVParser
@ -0,0 +1,12 @@
import CSVParser from '@/services/parsers/csv.service'
describe('Request', () => {
const parser = new CSVParser()
test('can parse text', () => {
const text = 'col 1,col 2\n1,2'
const parsed = parser.parse(text)
expect(parsed.meta.fields).toEqual(['col 1', 'col 2'])
expect(parsed.data[0]['col 1']).toEqual('1')
})
@ -6910,6 +6910,11 @@ pako@=1.0.10, pako@~1.0.5:
resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.10.tgz#4328badb5086a426aa90f541977d4955da5c9732"
integrity sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw==
papaparse@^5.0.2:
version "5.0.2"
resolved "https://registry.yarnpkg.com/papaparse/-/papaparse-5.0.2.tgz#447ef95a42015e0b0e52df717b44aedc78252dc9"
integrity sha512-FoaaFfNlCztJ7c+XD1Fgb0zIJ530HwSr6FBfM1mcMzLtIWoTxE5paBNJWiCWFjDrTzGiEG/uIUfqVzgKxqd+Sw==
parallel-transform@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/parallel-transform/-/parallel-transform-1.1.0.tgz#d410f065b05da23081fcd10f28854c29bda33b06"