fast-csv icon indicating copy to clipboard operation
fast-csv copied to clipboard

[BUG] ParserOptions throws an error with undefined delimiter

Open McAllaster opened this issue 3 months ago • 0 comments

Describe the bug When the delimiter parser option is explicitly set to undefined, an error is thrown when trying to access .length (here)

Parsing or Formatting?

  • [ ] Formatting
  • [x] Parsing

To Reproduce Create a new parser, passing an object with at least { delimiter: undefined } as an option.

It looks like the class ParserOptions is defining defaults that are able to be overwritten by passing undefined, but the type information allows undefined to be passed (as they are optional).

Expected behavior The default value , should be used instead of `undefined.

Screenshots No screenshot, but the error I was getting:

TypeError: Cannot read properties of undefined (reading 'length')
    at new fE (.../node_modules/@fast-csv/parse/src/ParserOptions.ts:74:28)

(minified, so fE does not mean anything here explicitly)

Desktop (please complete the following information):

  • OS: MacOS
  • OS Version: Sequoia
  • Node Version: 22.19.0

Additional context This is useful for abstracting options that default to undefined elsewhere.

I can submit a patch if this is indeed a bug, but for now I'm falling back to , manually as a workaround.

McAllaster avatar Sep 26 '25 22:09 McAllaster