CSVParse for Node.js

IssuesGitHub

Option relax_column_count_more

The relax_column_count_more option is inspired by the relax_column_count option. It tolerates data sets with inconsistent number of fields between records as long as the number of fields is superior to the expectation.

Refer to the relax_column_count option to learn about specific implementation details.

Usage

This example shows how the second line is tolerated despite having more fields than in the first line.

import assert from 'node:assert';
import { parse } from 'csv-parse';

parse(`
a,b
c,d,e
`.trim(), {
  relax_column_count_more: true
}, (err, records) => {
  assert.deepStrictEqual(records, [
    ['a', 'b'],
    ['c', 'd', 'e']
  ]);
});

About

The Node.js CSV project is an open source product hosted on GitHub and developed by Adaltas.