]> zoso.dev Git - nano-pow.git/commitdiff
Test empty string instead of undefined against regexp.
authorChris Duncan <chris@zoso.dev>
Tue, 11 Mar 2025 17:58:09 +0000 (10:58 -0700)
committerChris Duncan <chris@zoso.dev>
Tue, 11 Mar 2025 17:58:09 +0000 (10:58 -0700)
cli.js

diff --git a/cli.js b/cli.js
index cd5a47fbfb6c113bac261ae149638d9bcc506585..62194ff647fa4e9e17882c950f0b888a4ad91cbd 100755 (executable)
--- a/cli.js
+++ b/cli.js
@@ -8,7 +8,7 @@ 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)) {
+while (/^[0-9A-Fa-f]{64}$/.test(hash ?? '')) {
        hashes.unshift(hash)
        hash = args.pop()
 }