@konplit-services/common 1.0.292 → 1.0.293

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,2 @@
1
+ import { CURRENCY_TYPE } from "./currency-types";
2
+ export declare const formatCurrency: (amount: number, currency?: CURRENCY_TYPE, locale?: string) => string;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatCurrency = void 0;
4
+ const currency_types_1 = require("./currency-types");
5
+ const formatCurrency = (amount, currency = currency_types_1.CURRENCY_TYPE.NGN, locale = "en-NG") => {
6
+ return new Intl.NumberFormat(locale, {
7
+ style: "currency",
8
+ currency: currency,
9
+ }).format(amount);
10
+ };
11
+ exports.formatCurrency = formatCurrency;
12
+ //console.log(formatCurrency(123456.78, "USD")); // $123,456.78
13
+ //console.log(formatCurrency(123456.78, "EUR", "de-DE")); // 123.456,78 €
14
+ //console.log(formatCurrency(123456.78, "NGN", "en-NG")); // ₦123,456.78
@@ -12,6 +12,7 @@ export * from "./card-types";
12
12
  export * from "./chargeback";
13
13
  export * from "./charges";
14
14
  export * from "./currency-types";
15
+ export * from "./currency-formater";
15
16
  export * from "./custom-paginate";
16
17
  export * from "./extract-card-details";
17
18
  export * from "./invoice";
@@ -28,6 +28,7 @@ __exportStar(require("./card-types"), exports);
28
28
  __exportStar(require("./chargeback"), exports);
29
29
  __exportStar(require("./charges"), exports);
30
30
  __exportStar(require("./currency-types"), exports);
31
+ __exportStar(require("./currency-formater"), exports);
31
32
  __exportStar(require("./custom-paginate"), exports);
32
33
  __exportStar(require("./extract-card-details"), exports);
33
34
  __exportStar(require("./invoice"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konplit-services/common",
3
- "version": "1.0.292",
3
+ "version": "1.0.293",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",