diff options
author | Remco Bloemen <remco@wicked.ventures> | 2018-08-17 03:54:23 +0800 |
---|---|---|
committer | Remco Bloemen <remco@wicked.ventures> | 2018-08-22 05:14:22 +0800 |
commit | 1053aed74d2dcb5018a9647f21dd05e2902528fd (patch) | |
tree | c32c0b2dab902cdd9121e96cad714665299a956f /packages/utils | |
parent | f53157414f144a7ea8c24126c9d75d3168228130 (diff) | |
download | dexon-sol-tools-1053aed74d2dcb5018a9647f21dd05e2902528fd.tar dexon-sol-tools-1053aed74d2dcb5018a9647f21dd05e2902528fd.tar.gz dexon-sol-tools-1053aed74d2dcb5018a9647f21dd05e2902528fd.tar.bz2 dexon-sol-tools-1053aed74d2dcb5018a9647f21dd05e2902528fd.tar.lz dexon-sol-tools-1053aed74d2dcb5018a9647f21dd05e2902528fd.tar.xz dexon-sol-tools-1053aed74d2dcb5018a9647f21dd05e2902528fd.tar.zst dexon-sol-tools-1053aed74d2dcb5018a9647f21dd05e2902528fd.zip |
Set curstom inspect printer in BigNumber
Diffstat (limited to 'packages/utils')
-rw-r--r-- | packages/utils/src/configured_bignumber.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/packages/utils/src/configured_bignumber.ts b/packages/utils/src/configured_bignumber.ts index 2b22b6938..977042f1e 100644 --- a/packages/utils/src/configured_bignumber.ts +++ b/packages/utils/src/configured_bignumber.ts @@ -11,4 +11,15 @@ BigNumber.config({ DECIMAL_PLACES: 78, }); +// Set a debug print function for NodeJS +if (typeof window === 'undefined') { // Check if running in NodeJS + const util = require('util'); + + // Set a custom util.inspect function + (BigNumber.prototype as any)[util.inspect.custom] = function() { + // Return the readable string representation + return this.toString(); + }; +} + export { BigNumber }; |