Skip to content

[BUG] ParserOptions throws an error with undefined delimiter #1160

Description

@McAllaster

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
  • 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions