Skip to content

Commit

Permalink
Moving emptyLine state setting from processColumn to parseCycle. Lint…
Browse files Browse the repository at this point in the history
…er fixes.
  • Loading branch information
sekko27 committed Sep 21, 2023
1 parent a4357dd commit 5660dc2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ export class CSVReader {
}

private processColumn() {
this.emptyLine = false;
const result = this.decoder.decode(
this.columnBuffer.subarray(0, this.columnBufferIndex),
);
Expand Down Expand Up @@ -360,6 +359,7 @@ export class CSVReader {

if (!this.inColumn && this.hasNext(this.columnSeparator)) {
this.debug("columnSeparator");
this.emptyLine = false;
this.processColumn();
this.skip(this.columnSeparator.length);
continue;
Expand Down
10 changes: 5 additions & 5 deletions reader_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,14 +429,14 @@ Deno.test({
`col1,col2,col3
a,b,c
,,
d,e,f`
d,e,f`,
);
const rows = await asyncArrayFrom(readCSVRows(reader));
assertEquals(rows, [
["col1", "col2", "col3"],
["a", "b", "c"],
["", "", ""],
["d", "e", "f"]
])
}
})
["d", "e", "f"],
]);
},
});

0 comments on commit 5660dc2

Please sign in to comment.