From f9e2f636b908e134446f90056eaf827302c96d0a Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Tue, 11 Mar 2025 14:05:04 -0700 Subject: [PATCH] Fix command arguments being popped one too many times. --- cli.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cli.js b/cli.js index e8e7f31..5656b87 100755 --- a/cli.js +++ b/cli.js @@ -7,10 +7,8 @@ import * as fs from 'node:fs/promises' const args = process.argv.slice(2) const hashes = [] -let hash = args.pop() -while (/^[0-9A-Fa-f]{64}$/.test(hash ?? '')) { - hashes.unshift(hash) - hash = args.pop() +while (/^[0-9A-Fa-f]{64}$/.test(args[args.length - 1] ?? '')) { + hashes.unshift(args.pop()) } if (hashes.length === 0) { console.error('Invalid block hash input') -- 2.34.1