From 5660dc2d98a1ae4bd3ad57915c834f0d2f5d0fd7 Mon Sep 17 00:00:00 2001 From: Balazs Date: Thu, 21 Sep 2023 08:34:28 +0200 Subject: [PATCH] Moving emptyLine state setting from processColumn to parseCycle. Linter fixes. --- reader.ts | 2 +- reader_test.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/reader.ts b/reader.ts index 22aaa2c..292c01e 100644 --- a/reader.ts +++ b/reader.ts @@ -189,7 +189,6 @@ export class CSVReader { } private processColumn() { - this.emptyLine = false; const result = this.decoder.decode( this.columnBuffer.subarray(0, this.columnBufferIndex), ); @@ -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; diff --git a/reader_test.ts b/reader_test.ts index e094a6a..9214a22 100644 --- a/reader_test.ts +++ b/reader_test.ts @@ -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"], + ]); + }, +});