aboutsummaryrefslogtreecommitdiffstats
path: root/packages/utils/src/configured_bignumber.ts
diff options
context:
space:
mode:
authorRemco Bloemen <remco@wicked.ventures>2018-11-09 07:19:11 +0800
committerRemco Bloemen <remco@wicked.ventures>2018-11-09 07:19:11 +0800
commitdfef33bc41221c3f0f38d7e1c3e4163455b98b79 (patch)
tree027cd21d0de2a18cd5ea4f79190cccd4c479eb64 /packages/utils/src/configured_bignumber.ts
parentfd73c17db1346ce264700315f964d946216061a9 (diff)
downloaddexon-sol-tools-dfef33bc41221c3f0f38d7e1c3e4163455b98b79.tar
dexon-sol-tools-dfef33bc41221c3f0f38d7e1c3e4163455b98b79.tar.gz
dexon-sol-tools-dfef33bc41221c3f0f38d7e1c3e4163455b98b79.tar.bz2
dexon-sol-tools-dfef33bc41221c3f0f38d7e1c3e4163455b98b79.tar.lz
dexon-sol-tools-dfef33bc41221c3f0f38d7e1c3e4163455b98b79.tar.xz
dexon-sol-tools-dfef33bc41221c3f0f38d7e1c3e4163455b98b79.tar.zst
dexon-sol-tools-dfef33bc41221c3f0f38d7e1c3e4163455b98b79.zip
Added more comments
Diffstat (limited to 'packages/utils/src/configured_bignumber.ts')
-rw-r--r--packages/utils/src/configured_bignumber.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/packages/utils/src/configured_bignumber.ts b/packages/utils/src/configured_bignumber.ts
index 8e1491796..34b57d303 100644
--- a/packages/utils/src/configured_bignumber.ts
+++ b/packages/utils/src/configured_bignumber.ts
@@ -22,7 +22,12 @@ if (isNode) {
const util = require('util');
// Set a custom util.inspect function
+ // HACK: We add a function to the BigNumber class by assigning to the
+ // prototype. The function name is a symbol provided by Node.
(BigNumber.prototype as any)[util.inspect.custom] = function(): string {
+ // HACK: When executed, `this` will refer to the BigNumber instance.
+ // This is also why we need a function expression instead of an
+ // arrow function, as the latter does not have a `this`.
// Return the readable string representation
// tslint:disable-next-line: no-invalid-this
return this.toString();