aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/util
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-02 07:32:14 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-02 07:32:14 +0800
commita2e1bf0e6287e86c226b0801311f6f4498c893ed (patch)
tree5c03514c0d0afce1aba61341c079822030e0ece0 /packages/instant/src/util
parent7c30fd4b2da83c9522f9137f4d18e6c308f2b66f (diff)
downloaddexon-sol-tools-a2e1bf0e6287e86c226b0801311f6f4498c893ed.tar
dexon-sol-tools-a2e1bf0e6287e86c226b0801311f6f4498c893ed.tar.gz
dexon-sol-tools-a2e1bf0e6287e86c226b0801311f6f4498c893ed.tar.bz2
dexon-sol-tools-a2e1bf0e6287e86c226b0801311f6f4498c893ed.tar.lz
dexon-sol-tools-a2e1bf0e6287e86c226b0801311f6f4498c893ed.tar.xz
dexon-sol-tools-a2e1bf0e6287e86c226b0801311f6f4498c893ed.tar.zst
dexon-sol-tools-a2e1bf0e6287e86c226b0801311f6f4498c893ed.zip
Getting rid of BigNumberInput in favor of BigNumber
Diffstat (limited to 'packages/instant/src/util')
-rw-r--r--packages/instant/src/util/big_number_input.ts34
1 files changed, 0 insertions, 34 deletions
diff --git a/packages/instant/src/util/big_number_input.ts b/packages/instant/src/util/big_number_input.ts
deleted file mode 100644
index 370d91a0a..000000000
--- a/packages/instant/src/util/big_number_input.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-import { BigNumber } from '@0x/utils';
-import * as _ from 'lodash';
-
-/**
- * A BigNumber extension that is more flexible about decimal strings.
- * Such as allowing:
- * new BigNumberInput('0.') => 0
- * new BigNumberInput('1.') => 1
- * new BigNumberInput('1..') => still throws
- */
-export class BigNumberInput extends BigNumber {
- private readonly _isEndingWithDecimal: boolean;
- constructor(numberOrString: string | number) {
- if (_.isString(numberOrString)) {
- const hasDecimalPeriod = _.endsWith(numberOrString, '.');
- let internalString = numberOrString;
- if (hasDecimalPeriod) {
- internalString = numberOrString.slice(0, -1);
- }
- super(internalString);
- this._isEndingWithDecimal = hasDecimalPeriod;
- } else {
- super(numberOrString);
- this._isEndingWithDecimal = false;
- }
- }
- public toDisplayString(): string {
- const internalString = super.toString();
- if (this._isEndingWithDecimal) {
- return `${internalString}.`;
- }
- return internalString;
- }
-}