tso-data-models
Advanced tools
Comparing version 1.0.118 to 1.0.119
@@ -10,3 +10,4 @@ export declare class AssetSubmission { | ||
getSubmitPriceHash(tsoAddress: string): string; | ||
formatPrice(): void; | ||
} | ||
//# sourceMappingURL=AssetSubmission.d.ts.map |
@@ -20,2 +20,23 @@ "use strict"; | ||
}; | ||
AssetSubmission.prototype.formatPrice = function () { | ||
var str = this.price.toString(); | ||
var numArray = str.split('.'); | ||
var beforeDecimal = numArray[0]; | ||
var afterDecimal = numArray[1]; | ||
var rightSide; | ||
if (afterDecimal.length > 5) { | ||
rightSide = afterDecimal.substring(0, 5); | ||
} | ||
else if (afterDecimal.length < 5) { | ||
var digitsToAdd = 5 - afterDecimal.length; | ||
rightSide = afterDecimal; | ||
for (var i = 0; i < digitsToAdd; i++) { | ||
rightSide = rightSide + "0"; | ||
} | ||
} | ||
else { | ||
rightSide = afterDecimal; | ||
} | ||
this.price = parseInt("" + beforeDecimal + afterDecimal); | ||
}; | ||
return AssetSubmission; | ||
@@ -22,0 +43,0 @@ }()); |
{ | ||
"name": "tso-data-models", | ||
"version": "1.0.118", | ||
"version": "1.0.119", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -29,2 +29,21 @@ import { BigNumber, ethers } from "ethers"; | ||
} | ||
formatPrice() { | ||
const str = this.price.toString(); | ||
const numArray = str.split('.'); | ||
const beforeDecimal = numArray[0]; | ||
const afterDecimal = numArray[1]; | ||
let rightSide; | ||
if (afterDecimal.length > 5) { | ||
rightSide = afterDecimal.substring(0, 5); | ||
} else if (afterDecimal.length < 5) { | ||
const digitsToAdd = 5 - afterDecimal.length; | ||
rightSide = afterDecimal; | ||
for (let i = 0; i < digitsToAdd; i++) { | ||
rightSide = `${rightSide}0`; | ||
} | ||
} else { | ||
rightSide = afterDecimal; | ||
} | ||
this.price = parseInt(`${beforeDecimal}${afterDecimal}`); | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
145834
2156