@riocrypto/common 1.0.909 → 1.0.911

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 @@
1
+ export declare const numberWithCommas: (x: number, fixedNumber?: number) => string;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.numberWithCommas = void 0;
4
+ const numberWithCommas = (x, fixedNumber = 2) => {
5
+ return x
6
+ .toFixed(fixedNumber)
7
+ .toString()
8
+ .replace(/\B(?=(\d{3})+(?!\d))/g, ",");
9
+ };
10
+ exports.numberWithCommas = numberWithCommas;
@@ -0,0 +1 @@
1
+ export declare function roundToDecimals(num: number, decimals: number): number;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.roundToDecimals = void 0;
4
+ function roundToDecimals(num, decimals) {
5
+ const multiplier = Math.pow(10, decimals);
6
+ return Math.round(num * multiplier) / multiplier;
7
+ }
8
+ exports.roundToDecimals = roundToDecimals;
package/build/index.d.ts CHANGED
@@ -176,6 +176,8 @@ export * from "./helpers/round-down-to-two-decimal-places";
176
176
  export * from "./helpers/humanize-order-status";
177
177
  export * from "./helpers/humanize-kyc-status";
178
178
  export * from "./helpers/format-transaction-hash";
179
+ export * from "./helpers/round-to-decimals";
180
+ export * from "./helpers/number-with-commas";
179
181
  export * from "./clients/rio-client";
180
182
  export * from "./clients/rio-admin-client";
181
183
  export * from "./constants/mexico-fiscal-regimens";
package/build/index.js CHANGED
@@ -192,6 +192,8 @@ __exportStar(require("./helpers/round-down-to-two-decimal-places"), exports);
192
192
  __exportStar(require("./helpers/humanize-order-status"), exports);
193
193
  __exportStar(require("./helpers/humanize-kyc-status"), exports);
194
194
  __exportStar(require("./helpers/format-transaction-hash"), exports);
195
+ __exportStar(require("./helpers/round-to-decimals"), exports);
196
+ __exportStar(require("./helpers/number-with-commas"), exports);
195
197
  __exportStar(require("./clients/rio-client"), exports);
196
198
  __exportStar(require("./clients/rio-admin-client"), exports);
197
199
  __exportStar(require("./constants/mexico-fiscal-regimens"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.909",
3
+ "version": "1.0.911",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",