aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/util
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-10-26 09:35:06 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-10-26 09:35:06 +0800
commitd5d99b9d2e3c793a95c68c1035246644b3ae80c6 (patch)
tree880f13fd7dba96285c23986e505f3166de099a4c /packages/instant/src/util
parentab2759f43105c0f2d441790e138840706c6759f8 (diff)
downloaddexon-sol-tools-d5d99b9d2e3c793a95c68c1035246644b3ae80c6.tar
dexon-sol-tools-d5d99b9d2e3c793a95c68c1035246644b3ae80c6.tar.gz
dexon-sol-tools-d5d99b9d2e3c793a95c68c1035246644b3ae80c6.tar.bz2
dexon-sol-tools-d5d99b9d2e3c793a95c68c1035246644b3ae80c6.tar.lz
dexon-sol-tools-d5d99b9d2e3c793a95c68c1035246644b3ae80c6.tar.xz
dexon-sol-tools-d5d99b9d2e3c793a95c68c1035246644b3ae80c6.tar.zst
dexon-sol-tools-d5d99b9d2e3c793a95c68c1035246644b3ae80c6.zip
chore: dont override toString of BigNumber and other PR feedback
Diffstat (limited to 'packages/instant/src/util')
-rw-r--r--packages/instant/src/util/asset.ts2
-rw-r--r--packages/instant/src/util/big_number_input.ts (renamed from packages/instant/src/util/big_number.ts)16
2 files changed, 9 insertions, 9 deletions
diff --git a/packages/instant/src/util/asset.ts b/packages/instant/src/util/asset.ts
index e42727d84..2c5b6325d 100644
--- a/packages/instant/src/util/asset.ts
+++ b/packages/instant/src/util/asset.ts
@@ -51,7 +51,7 @@ export const assetUtils = {
if (symbol.length <= 5) {
return symbol;
}
- return `${symbol.slice(0, 3)}...`;
+ return `${symbol.slice(0, 3)}…`;
},
getAssociatedAssetDataIfExists: (assetData: string, network: Network): string | undefined => {
const assetDataGroupIfExists = _.find(assetDataNetworkMapping, value => value[network] === assetData);
diff --git a/packages/instant/src/util/big_number.ts b/packages/instant/src/util/big_number_input.ts
index a34d22d76..d2a9a8dc5 100644
--- a/packages/instant/src/util/big_number.ts
+++ b/packages/instant/src/util/big_number_input.ts
@@ -4,24 +4,24 @@ 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
+ * new BigNumberInput('0.') => 0
+ * new BigNumberInput('1.') => 1
+ * new BigNumberInput('1..') => still throws
*/
export class BigNumberInput extends BigNumber {
- private readonly _hasDecimalPeriod: boolean;
+ private readonly _isEndingWithDecimal: boolean;
constructor(bigNumberString: string) {
const hasDecimalPeriod = _.endsWith(bigNumberString, '.');
let internalString = bigNumberString;
if (hasDecimalPeriod) {
- internalString = bigNumberString.slice(0, bigNumberString.length - 1);
+ internalString = bigNumberString.slice(0, -1);
}
super(internalString);
- this._hasDecimalPeriod = hasDecimalPeriod;
+ this._isEndingWithDecimal = hasDecimalPeriod;
}
- public toString(): string {
+ public toDisplayString(): string {
const internalString = super.toString();
- if (this._hasDecimalPeriod) {
+ if (this._isEndingWithDecimal) {
return `${internalString}.`;
}
return internalString;