From e46d1871feff32acbcdc7574aff91dbd37d25ea5 Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Sat, 12 Jul 2025 22:44:16 -0700 Subject: [PATCH] Delete redundant BOM check `TextDecoderStream` already handles it upstream, no need to check for it again. --- src/core.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core.js b/src/core.js index 948eefb..8133fc5 100644 --- a/src/core.js +++ b/src/core.js @@ -111,7 +111,7 @@ export class CSVReader extends ReadableStream { constructor(path, options = {}) { const { encoding = 'utf-8' } = options; const readableStream = createFileStream(path) - .pipeThrough(new TextDecoderStream(encoding)) + .pipeThrough(new TextDecoderStream(encoding)) // Byte order mark (BOM) is removed, if present .pipeThrough(new TransformStream({ transform: (chunk, controller) => this.#transform(chunk, controller), flush: (controller) => this.#flush(controller) @@ -158,7 +158,7 @@ export class CSVReader extends ReadableStream { this.#field += char; } } - else if (char === '\r' || char === '\uFEFF') { } // Ignore CR (newline logic is handled by LF) and byte order mark + else if (char === '\r') { } // Ignore CR (newline logic is handled by LF) else if (char === ',') { // Terminate the field and do not add char to field this.#row.push(this.#field); this.#field = ''; -- 2.47.3