CSVParse for Node.js

IssuesGitHub

Option relax_column_count_less

Table of Contents

The relax_column_count_less 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 inferior 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 less fields than in the first line.

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

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