1 | ;
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.stringify = stringify;
|
7 |
|
8 | var _bigInt = require("./is/bigInt");
|
9 |
|
10 | // Copyright 2017-2022 @polkadot/util authors & contributors
|
11 | // SPDX-License-Identifier: Apache-2.0
|
12 |
|
13 | /** @internal */
|
14 | function replacer(_, v) {
|
15 | return (0, _bigInt.isBigInt)(v) ? v.toString() : v;
|
16 | }
|
17 | /**
|
18 | * @name stringify
|
19 | * @summary Performs a JSON.stringify, with BigInt handling
|
20 | * @description A wrapper for JSON.stringify that handles BigInt values transparently, converting them to string. No differences from the native JSON.stringify function otherwise.
|
21 | */
|
22 |
|
23 |
|
24 | function stringify(value, space) {
|
25 | return JSON.stringify(value, replacer, space);
|
26 | } |
\ | No newline at end of file |