yahoo / serialize-javascript

Serialize JavaScript to a superset of JSON that includes regular expressions and functions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BigInt `0n` Throws Error

WilsontheWolf opened this issue · comments

commented

The BigInt 0n throws an error when serializing, unlike every other BigInt.

image

commented

I found this is because 0n evaluates true in this if clause and the original value (as a bigint) is returned directly.

if (!value && value !== undefined) {
return value;
}

I'm not really sure what is the intention of this check.

published v6.0.1.