From 5bc8179e981041a3868fd946ac7cf022faa2212b Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Mon, 28 Apr 2025 01:49:30 -0700 Subject: [PATCH] Refactor to avoid undefined variables --- src/core.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/core.js b/src/core.js index 5ffcec4..37b3636 100644 --- a/src/core.js +++ b/src/core.js @@ -312,17 +312,16 @@ export class CSVTransformer extends TransformStream { const results = await Promise.allSettled(this.#concurrent); this.#concurrent.length = 0; for (const r of results) { - const { status, value, reason } = r; - if (status === 'rejected') { - if (reason instanceof Error) { - throw reason; + if (r.status === 'rejected') { + if (r.reason instanceof Error) { + throw r.reason; } else { - throw new Error(reason); + throw new Error(r.reason); } } else { - this.#enqueueRow(value, controller); + this.#enqueueRow(r.value, controller); } } } -- 2.47.3