From 1053aed74d2dcb5018a9647f21dd05e2902528fd Mon Sep 17 00:00:00 2001 From: Remco Bloemen Date: Thu, 16 Aug 2018 12:54:23 -0700 Subject: Set curstom inspect printer in BigNumber --- packages/utils/src/configured_bignumber.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'packages/utils/src/configured_bignumber.ts') 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 }; -- cgit