From: Ardis Lu Date: Mon, 28 Apr 2025 08:49:30 +0000 (-0700) Subject: Refactor to avoid undefined variables X-Git-Tag: v0.1.0~25 X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=5bc8179e981041a3868fd946ac7cf022faa2212b;p=csvio Refactor to avoid undefined variables --- 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); } } }