CSVParse for Node.js

IssuesGitHub

Option comment_no_infix

The comment_no_infix option restricts the definition of comments to full lines. Comment characters defined in the middle of a line are not interpreted as such.

Comments are disabled by default. Thus, this option only takes effect when comments are activated.

Example

While the default behavior generates [ [ 'a', 'b' ] ], activating comment_no_infix in the example below disregards the comment character present in the second line.

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

const output = parse(`
# Illustrate the usage of comment_no_infix
a,b#,c
`.trim(), {
  comment: '#',
  comment_no_infix: true
});

assert.deepStrictEqual(output, [
  ['a', 'b#', 'c']
]);

About

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