feat: fixing bug in object
This commit is contained in:
parent
fd6b40ca19
commit
e24cb16e8e
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "async-convert-csv-to-json",
|
||||
"version": "1.4.1",
|
||||
"version": "1.4.2",
|
||||
"description": "convert csv file to json",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
@ -6,8 +6,8 @@ const csvToJson = (csv) => {
|
||||
const result = [];
|
||||
const headers = lines[0].split(',');
|
||||
const contents = lines.slice(1, lines.length - 1)
|
||||
const obj = {};
|
||||
for (const content of contents) {
|
||||
const obj = {};
|
||||
const currentline = content.split(',');
|
||||
for (let j = 0; j < headers.length; j++) {
|
||||
obj[headers[j]] = currentline[j];
|
||||
|
Loading…
x
Reference in New Issue
Block a user