Skip to content
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

preFileLine line index is not incremented for the second line or row in CSV #360

Open
Jagadeshkumar-code opened this issue Jan 29, 2020 · 1 comment

Comments

@Jagadeshkumar-code
Copy link

Jagadeshkumar-code commented Jan 29, 2020

Hello,

I am using the following sample code to convert CSV to JSON. while iterating csv rows, first iteration the lineIdx value coming as 1 and second-iteration also lineIdx value coming as 1. actually preFileLine line index value is not incremented for the second line in CSV. but the third line incrementing by 1 and the value is 2.

Is it an npm module issue? How can I solve this problem?

Note: I am using "csvtojson": "^1.1.9", verions

csv().fromStream(request.get('http://localhost:3000/response'))
    .preFileLine((fileLineString, lineIdx) => {
            if (lineIdx === 1) {
                return fileLineString.replace(/ /g,'')
            }
        return fileLineString;
    })
@randallmeeker
Copy link

Same just ran into this. Good to know I was not crazy here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants