import { deepStrictEqual } from 'node:assert';
import { Readable } from 'node:stream';
import csvParserFactory from 'csv-parser';
deepStrictEqual(
await Readable.from(["foo\r", "\nbar\r\n", "baz\r\n"])
.pipe(csvParserFactory())
.toArray(),
await Readable.from(["foo\r\n", "bar\r\n", "baz\r\n"])
.pipe(csvParserFactory())
.toArray(),
);
Cause
This happens because csv-parser is fine with nextChr being null when this.state.first is true. Instead it should wait until there's at least one more byte or the input stream is closed.
Expected Behavior
The assert in the repro passes.
Actual Behavior
The assert in the repro fails.
How Do We Reproduce?
Cause
This happens because
csv-parser
is fine withnextChr
beingnull
whenthis.state.first
istrue
. Instead it should wait until there's at least one more byte or the input stream is closed.