CSVParse for Node.js

IssuesGitHub

Option skip_records_with_empty_values

Table of Contents

The skip_records_with_empty_values option don't generate records for lines containing empty values (column matching /\s*/), empty Buffer or equals to null and undefined if their value was casted, defaults to false.

Usage

In this example, the second line contains empty fields composed of zero characters, spaces and tabs:

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

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