fix(javascript): read a BigInt literal's truthiness from any spelling

Older Babel keeps a BigInt literal's source digits, which may carry a
0x/0o/0b prefix, so a hexadecimal zero read as truthy and a falsy socket host
such as 0x0n could drop a valid acquisition. Parse the value with BigInt.

Refs #10002

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
This commit is contained in:
gensokyo-devandgensokyo-dev authored and Ysopwnable committed 2026-11-14 14:44:47 +01:00
1 parent 98540f24e0
commit fe80d52c9e
2 files changed
+12 -2

No files matched your search

@@ -78,6 +78,9 @@ it.each([
["a negative-zero host", `net.connect({ port: 0, host: -0 })`],
["a false host", `net.connect({ port: 0, host: false })`],
["a zero BigInt host", `net.connect({ port: 0, host: 0n })`],
["a hexadecimal zero BigInt host", `net.connect({ port: 0, host: 0x0n })`],
["an octal zero BigInt host", `net.connect({ port: 0, host: 0o0n })`],
["a binary zero BigInt host", `net.connect({ port: 0, host: 0b0n })`],
["a NaN host", `net.connect({ port: 0, host: NaN })`],
["a void host", `net.connect({ port: 0, host: void 0 })`],
["a negated host", `net.connect({ port: 0, host: !1 })`],