Skip to content
This repository has been archived by the owner on Jun 28, 2021. It is now read-only.

All rows skipped when header's column count is less than the following row's column count #303

Closed
ajaz-rehman opened this issue Dec 16, 2020 · 1 comment
Labels

Comments

@ajaz-rehman
Copy link
Contributor

ajaz-rehman commented Dec 16, 2020

Describe the bug

When we set skip_lines_with_error to true and relaxColumnCount to true and the header has less number of columns than the following rows then the parser does not iterate over any rows except header.

To Reproduce

Copy and run this code

const parse = require('csv-parse');

const data = 'Email\na@test.com,name';

async function test(data) {
	const parser = parse(data, {
		skip_lines_with_error: true,
		relaxColumnCount: true,
	});

	for await (const record of parser) {
		console.log(record);
	}
}

test(data);

Additional context

If you set skip_lines_with_error to false then all rows are printed as expected.

@ajaz-rehman
Copy link
Contributor Author

ajaz-rehman commented Dec 17, 2020

Thank you so much for fixing it.

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

No branches or pull requests

1 participant