trentm / node-bunyan

a simple and fast JSON logging module for node.js services
Other
7.15k stars 513 forks source link

Support serializing bigint values #713

Open amccarthy1 opened 11 months ago

amccarthy1 commented 11 months ago

Fixes #662

The available JSON serialization utilities do not natively support stringifying BigInt values, but they do support passing replacer arguments for serialization of custom or unsupported types.

In order not to crash when serializing BigInt values, we can pass a replacer function that substitutes these values to a string representation. The chosen format is 12345n, which aligns with most other string representations, as well as the shorthand syntax in later versions of JavaScript.

amccarthy1 commented 10 months ago

@trentm sorry to pester you on this. Any interest in getting this quick fix merged? I understand if not, but would be helpful to know if I should spend any more time on this.