From 30deca8113b44f08efa0c989283ee2f7c739a105 Mon Sep 17 00:00:00 2001 From: Aleen Date: Mon, 28 Oct 2019 11:38:12 +0800 Subject: [PATCH] fix: avoid conflict with double quote within data --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 99f6f09..11cbb0c 100644 --- a/index.js +++ b/index.js @@ -120,7 +120,7 @@ class CsvParser extends Transform { } for (let i = start; i < end; i++) { - const isStartingQuote = !isQuoted && buffer[i] === quote + const isStartingQuote = !isQuoted && buffer[i] === quote && (i === 1 || buffer[i - 1] === comma) const isEndingQuote = isQuoted && buffer[i] === quote && i + 1 <= end && buffer[i + 1] === comma const isEscape = isQuoted && buffer[i] === escape && i + 1 < end && buffer[i + 1] === quote