@cosmjs/math
Advanced tools
Comparing version 0.28.12-0 to 0.28.13
@@ -18,5 +18,2 @@ "use strict"; | ||
constructor(atomics, fractionalDigits) { | ||
if (!atomics.match(/^[0-9]+$/)) { | ||
throw new Error("Invalid string format. Only non-negative integers in decimal representation supported."); | ||
} | ||
this.data = { | ||
@@ -36,7 +33,3 @@ atomics: new bn_js_1.default(atomics), | ||
let fractional; | ||
if (input === "") { | ||
whole = "0"; | ||
fractional = ""; | ||
} | ||
else if (input.search(/\./) === -1) { | ||
if (input.search(/\./) === -1) { | ||
// integer format, no separator | ||
@@ -43,0 +36,0 @@ whole = input; |
/** Internal interface to ensure all integer types can be used equally */ | ||
interface Integer { | ||
readonly toNumber: () => number; | ||
readonly toBigInt: () => bigint; | ||
readonly toString: () => string; | ||
@@ -27,3 +26,2 @@ } | ||
toNumber(): number; | ||
toBigInt(): bigint; | ||
toString(): string; | ||
@@ -36,3 +34,2 @@ } | ||
toNumber(): number; | ||
toBigInt(): bigint; | ||
toString(): string; | ||
@@ -45,3 +42,2 @@ } | ||
toNumber(): number; | ||
toBigInt(): bigint; | ||
toString(): string; | ||
@@ -66,5 +62,4 @@ } | ||
toString(): string; | ||
toBigInt(): bigint; | ||
toNumber(): number; | ||
} | ||
export {}; |
@@ -76,5 +76,2 @@ "use strict"; | ||
} | ||
toBigInt() { | ||
return BigInt(this.toNumber()); | ||
} | ||
toString() { | ||
@@ -107,5 +104,2 @@ return this.data.toString(); | ||
} | ||
toBigInt() { | ||
return BigInt(this.toNumber()); | ||
} | ||
toString() { | ||
@@ -131,5 +125,2 @@ return this.data.toString(); | ||
} | ||
toBigInt() { | ||
return BigInt(this.toNumber()); | ||
} | ||
toString() { | ||
@@ -203,5 +194,2 @@ return this.data.toString(); | ||
} | ||
toBigInt() { | ||
return BigInt(this.toString()); | ||
} | ||
toNumber() { | ||
@@ -208,0 +196,0 @@ return this.data.toNumber(); |
{ | ||
"name": "@cosmjs/math", | ||
"version": "0.28.12-0", | ||
"version": "0.28.13", | ||
"description": "Math helpers for blockchain projects", | ||
@@ -49,3 +49,3 @@ "contributors": [ | ||
"@types/eslint-plugin-prettier": "^3", | ||
"@types/jasmine": "^4", | ||
"@types/jasmine": "^3.8", | ||
"@types/karma-firefox-launcher": "^2", | ||
@@ -65,3 +65,3 @@ "@types/karma-jasmine": "^4", | ||
"glob": "^7.1.6", | ||
"jasmine": "^4", | ||
"jasmine": "^3.99", | ||
"jasmine-spec-reporter": "^6", | ||
@@ -71,3 +71,3 @@ "karma": "^6.3.14", | ||
"karma-firefox-launcher": "^2.1.0", | ||
"karma-jasmine": "^5", | ||
"karma-jasmine": "^4.0.1", | ||
"karma-jasmine-html-reporter": "^1.5.4", | ||
@@ -80,7 +80,6 @@ "nyc": "^15.1.0", | ||
"typedoc": "^0.22", | ||
"typescript": "~4.6", | ||
"typescript": "~4.4", | ||
"webpack": "^5.32.0", | ||
"webpack-cli": "^4.6.0" | ||
}, | ||
"stableVersion": "0.28.11" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
182018
17
1480