@injectivelabs/utils 1.0.46 → 1.0.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ import { BigNumber } from './classes';
2
+ export declare const getSignificantDecimalsFromNumber: (number: BigNumber | number | string) => number;
3
+ //# sourceMappingURL=numbers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../src/numbers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAIrC,eAAO,MAAM,gCAAgC,WACnC,SAAS,GAAG,MAAM,GAAG,MAAM,KAClC,MAcF,CAAA"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSignificantDecimalsFromNumber = void 0;
4
+ const classes_1 = require("./classes");
5
+ const $BigNumber = classes_1.BigNumber.clone({ ROUNDING_MODE: classes_1.BigNumber.ROUND_DOWN });
6
+ const getSignificantDecimalsFromNumber = (number) => {
7
+ if (Math.floor(new $BigNumber(number).toNumber()) === number) {
8
+ return 0;
9
+ }
10
+ const parts = new $BigNumber(number).toFixed().split('.');
11
+ const [, decimals] = parts;
12
+ /** Number doesn't have decimals */
13
+ if (!decimals) {
14
+ return 0;
15
+ }
16
+ return decimals.length;
17
+ };
18
+ exports.getSignificantDecimalsFromNumber = getSignificantDecimalsFromNumber;
19
+ //# sourceMappingURL=numbers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"numbers.js","sourceRoot":"","sources":["../src/numbers.ts"],"names":[],"mappings":";;;AAAA,uCAAqC;AAErC,MAAM,UAAU,GAAG,mBAAS,CAAC,KAAK,CAAC,EAAE,aAAa,EAAE,mBAAS,CAAC,UAAU,EAAE,CAAC,CAAA;AAEpE,MAAM,gCAAgC,GAAG,CAC9C,MAAmC,EAC3B,EAAE;IACV,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,MAAM,EAAE;QAC5D,OAAO,CAAC,CAAA;KACT;IAED,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACzD,MAAM,CAAC,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAA;IAE1B,mCAAmC;IACnC,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,CAAC,CAAA;KACT;IAED,OAAO,QAAQ,CAAC,MAAM,CAAA;AACxB,CAAC,CAAA;AAhBY,QAAA,gCAAgC,oCAgB5C"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@injectivelabs/utils",
3
3
  "description": "List of utils and helper functions that can be reused throughout Injective's projects.",
4
- "version": "1.0.46",
4
+ "version": "1.0.47",
5
5
  "author": {
6
6
  "name": "Bojan Angjelkoski",
7
7
  "email": "bojan@injectivelabs.org"
@@ -40,5 +40,5 @@
40
40
  "snakecase-keys": "^5.1.2",
41
41
  "store2": "^2.12.0"
42
42
  },
43
- "gitHead": "3f774e11b95ba0f7d63d52efdbf568ba4643a000"
43
+ "gitHead": "0ca64634da59b35c1ebb6ed7b4625066329837d6"
44
44
  }