[object Object]

← back to Re Flyer Aggregator

ingest-public-deals: fix LIMIT NaN crash when run without --n (indexOf(-1)+1 → argv[0] node-path → NaN); default N=8000 safely. Affected manual/loop runs, not the dtt-cron (uses ingest-la-sales) (TK-10708)

c127446f7dbb0177507e31d10edb038a6c3fb66a · 2026-08-19 18:06:19 -0700 · Steve Abrams

Files touched

Diff

commit c127446f7dbb0177507e31d10edb038a6c3fb66a
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Wed Aug 19 18:06:19 2026 -0700

    ingest-public-deals: fix LIMIT NaN crash when run without --n (indexOf(-1)+1 → argv[0] node-path → NaN); default N=8000 safely. Affected manual/loop runs, not the dtt-cron (uses ingest-la-sales) (TK-10708)
---
 scripts/ingest-public-deals.mjs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/ingest-public-deals.mjs b/scripts/ingest-public-deals.mjs
index 9156375..8d607bf 100644
--- a/scripts/ingest-public-deals.mjs
+++ b/scripts/ingest-public-deals.mjs
@@ -13,7 +13,8 @@ import { dirname, join } from 'node:path';
 
 const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');
 const STORE = join(ROOT, 'data', 'deal-store.json');
-const N = parseInt((process.argv[process.argv.indexOf('--n') + 1]) || '8000', 10);
+const _ni = process.argv.indexOf('--n');   // guard: when --n is absent, indexOf=-1 → argv[0] (node path) → NaN LIMIT
+const N = _ni >= 0 ? (parseInt(process.argv[_ni + 1], 10) || 8000) : 8000;
 const CAP = 12000;
 
 const money = n => n >= 1e9 ? '$' + (n / 1e9).toFixed(1) + 'B' : n >= 1e6 ? '$' + Math.round(n / 1e6) + 'M' : '$' + Math.round(n / 1e3) + 'K';

← f042cb6 ad-intel: catch GTM-injected pixels (fetch+scan gtm.js conta  ·  back to Re Flyer Aggregator  ·  auto-data-snapshot: 2026-08-19T18:57:31 (5 data files) — dat 79dfa04 →