tso-data-models
Advanced tools
Comparing version 1.0.129 to 1.0.130
@@ -13,5 +13,3 @@ "use strict"; | ||
this.random = Math.floor(Math.random() * 100000); | ||
console.log('ffff '); | ||
this.formatPrice(); | ||
console.log('ggg '); | ||
} | ||
@@ -26,18 +24,17 @@ AssetSubmission.prototype.saveObject = function () { | ||
var _a; | ||
console.log('111 '); | ||
console.log(this); | ||
var str = (_a = this.price) === null || _a === void 0 ? void 0 : _a.toString(); | ||
var numArray = str === null || str === void 0 ? void 0 : str.split('.'); | ||
var beforeDecimal = numArray[0]; | ||
var afterDecimal = numArray[1]; | ||
console.log('3333 '); | ||
var rightSide; | ||
if (this.price == "0") { | ||
} | ||
else if (!this.price.includes('.')) { | ||
this.price = this.price + "00000"; | ||
} | ||
else { | ||
var priceSplit = (_a = this.price) === null || _a === void 0 ? void 0 : _a.split('.'); | ||
var beforeDecimal = priceSplit[0]; | ||
var afterDecimal = priceSplit[1]; | ||
var rightSide = void 0; | ||
//Remove Leading Zero | ||
if (beforeDecimal.startsWith('0')) { | ||
beforeDecimal = beforeDecimal.substr(1, beforeDecimal.length); | ||
} | ||
// If too many digits truncate | ||
if ((afterDecimal === null || afterDecimal === void 0 ? void 0 : afterDecimal.length) > 5) { | ||
rightSide = afterDecimal === null || afterDecimal === void 0 ? void 0 : afterDecimal.substring(0, 5); | ||
// Number is too few DIgits | ||
} | ||
@@ -56,2 +53,5 @@ else if (afterDecimal.length < 5) { | ||
} | ||
else { | ||
this.price = this.price + "00000"; | ||
} | ||
}; | ||
@@ -58,0 +58,0 @@ return AssetSubmission; |
{ | ||
"name": "tso-data-models", | ||
"version": "1.0.129", | ||
"version": "1.0.130", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -20,5 +20,3 @@ import { BigNumber, ethers } from "ethers"; | ||
this.random = Math.floor(Math.random() * 100000); | ||
console.log('ffff ') | ||
this.formatPrice(); | ||
console.log('ggg ') | ||
} | ||
@@ -34,18 +32,19 @@ | ||
formatPrice() { | ||
console.log('111 ') | ||
console.log(this) | ||
const str = this.price?.toString(); | ||
const numArray = str?.split('.'); | ||
const beforeDecimal = numArray[0]; | ||
const afterDecimal = numArray[1]; | ||
console.log('3333 ') | ||
let rightSide; | ||
if (this.price == "0") { | ||
} else if (!this.price.includes('.')) { | ||
this.price = `${this.price}00000`; | ||
} else { | ||
const priceSplit = this.price?.split('.'); | ||
let beforeDecimal = priceSplit[0]; | ||
const afterDecimal = priceSplit[1]; | ||
let rightSide; | ||
//Remove Leading Zero | ||
if (beforeDecimal.startsWith('0')) { | ||
beforeDecimal = beforeDecimal.substr(1, beforeDecimal.length); | ||
} | ||
// If too many digits truncate | ||
if (afterDecimal?.length > 5) { | ||
rightSide = afterDecimal?.substring(0, 5); | ||
// Number is too few DIgits | ||
} else if (afterDecimal.length < 5) { | ||
@@ -58,9 +57,9 @@ const digitsToAdd = 5 - afterDecimal?.length; | ||
} else { | ||
rightSide = afterDecimal; | ||
rightSide = afterDecimal | ||
} | ||
this.price = `${beforeDecimal}${afterDecimal}`; | ||
} else { | ||
this.price = `${this.price}00000`; | ||
} | ||
} | ||
} |
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
147713