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

Only skip first n lines in the first chunk and don't take the first line as header (#1045) #1046

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jkruke
Copy link

@jkruke jkruke commented Mar 7, 2024

References #1045

@@ -1585,11 +1585,11 @@ var PARSE_TESTS = [
}
},
{
description: "Skip First N number of lines , with header and 3 rows",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not remove existing test suite but add a new test latter.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did'nt remove the test, I corrected it.
As I already mentioned, the first line should be expected to be the header row in the result. (because it should be skipped with skipFirstNLines=1

papaparse.js Outdated
@@ -511,6 +511,11 @@ License: MIT
this.parseChunk = function(chunk, isFakeChunk)
{
// First chunk pre-processing
const skipFirstNLines = parseInt(this._config.skipFirstNLines) || 0;
if (this.isFirstChunk && skipFirstNLines > 0) {
const splitChunk = chunk.split('\n');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not hardcode the line break, there is a config setter which defines the valid line breaks and allows the user to change them. Code should work for any of them.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! I changed the code. Unfortunately, made it a bit more complicated because config.newline might be undefined. I used the same approach like here

@foobarnes
Copy link

@jkruke @pokoli Is this ready to merge? Can I do any work on it to get it through? Pretty essentially on our end.

@jkruke
Copy link
Author

jkruke commented Apr 21, 2024

Actually, the reviewer @pokoli should re-review my actions regarding to his comments
From my point of view, no further work needs to be done then

@foobarnes
Copy link

@pokoli Any update 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

Successfully merging this pull request may close these issues.

None yet

4 participants