1 | ;
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.stringify = void 0;
|
4 | const bigInt_js_1 = require("./is/bigInt.js");
|
5 | /** @internal */
|
6 | function replacer(_, v) {
|
7 | return (0, bigInt_js_1.isBigInt)(v)
|
8 | ? v.toString()
|
9 | : v;
|
10 | }
|
11 | /**
|
12 | * @name stringify
|
13 | * @summary Performs a JSON.stringify, with BigInt handling
|
14 | * @description A wrapper for JSON.stringify that handles BigInt values transparently, converting them to string. No differences from the native JSON.stringify function otherwise.
|
15 | */
|
16 | function stringify(value, space) {
|
17 | return JSON.stringify(value, replacer, space);
|
18 | }
|
19 | exports.stringify = stringify;
|