@injectivelabs/utils
Advanced tools
Comparing version 1.0.63 to 1.0.64
@@ -5,3 +5,4 @@ export * from './classes/index'; | ||
export * from './time'; | ||
export * from './numbers'; | ||
export * from './constants'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -21,3 +21,4 @@ "use strict"; | ||
__exportStar(require("./time"), exports); | ||
__exportStar(require("./numbers"), exports); | ||
__exportStar(require("./constants"), exports); | ||
//# sourceMappingURL=index.js.map |
import { BigNumber } from './classes'; | ||
export declare const getSignificantDecimalsFromNumber: (number: BigNumber | number | string) => number; | ||
export declare const getExactDecimalsFromNumber: (number: number | string) => number; | ||
//# sourceMappingURL=numbers.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getSignificantDecimalsFromNumber = void 0; | ||
exports.getExactDecimalsFromNumber = exports.getSignificantDecimalsFromNumber = void 0; | ||
const classes_1 = require("./classes"); | ||
@@ -19,2 +19,16 @@ const $BigNumber = classes_1.BigNumber.clone({ ROUNDING_MODE: classes_1.BigNumber.ROUND_DOWN }); | ||
exports.getSignificantDecimalsFromNumber = getSignificantDecimalsFromNumber; | ||
const getExactDecimalsFromNumber = (number) => { | ||
if (!number.toString().includes('.')) { | ||
return 0; | ||
} | ||
if (Number(number) % 1 === 0) { | ||
return 0; | ||
} | ||
const [, decimals] = number.toString().split('.'); | ||
if (!decimals) { | ||
return 0; | ||
} | ||
return decimals.length; | ||
}; | ||
exports.getExactDecimalsFromNumber = getExactDecimalsFromNumber; | ||
//# sourceMappingURL=numbers.js.map |
{ | ||
"name": "@injectivelabs/utils", | ||
"description": "List of utils and helper functions that can be reused throughout Injective's projects.", | ||
"version": "1.0.63", | ||
"version": "1.0.64", | ||
"author": { | ||
@@ -44,3 +44,3 @@ "name": "Bojan Angjelkoski", | ||
}, | ||
"gitHead": "d452b6574ebc880c210fec27180c2f5eeed6159e" | ||
"gitHead": "77d292f25a2457d33cc8a067348265e92d4244cd" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
72035
778