@react-pakistan/util-functions 1.24.12 → 1.24.13
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.
- package/general/format-pricing.d.ts +1 -0
- package/general/format-pricing.js +23 -0
- package/general/index.d.ts +1 -0
- package/general/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const formatPricing: (value: string | number) => string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatPricing = void 0;
|
|
4
|
+
var formatPricing = function (value) {
|
|
5
|
+
var result = '';
|
|
6
|
+
if (typeof value === 'string') {
|
|
7
|
+
var pricing = Number(value).toFixed(2);
|
|
8
|
+
var formattedPrice = new Intl.NumberFormat('en-US', {
|
|
9
|
+
minimumFractionDigits: 2,
|
|
10
|
+
maximumFractionDigits: 2,
|
|
11
|
+
}).format(Number(pricing));
|
|
12
|
+
result = formattedPrice;
|
|
13
|
+
}
|
|
14
|
+
if (typeof value === 'number') {
|
|
15
|
+
var formattedPrice = new Intl.NumberFormat('en-US', {
|
|
16
|
+
minimumFractionDigits: 2,
|
|
17
|
+
maximumFractionDigits: 2,
|
|
18
|
+
}).format(Number(value));
|
|
19
|
+
result = formattedPrice;
|
|
20
|
+
}
|
|
21
|
+
return result;
|
|
22
|
+
};
|
|
23
|
+
exports.formatPricing = formatPricing;
|
package/general/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from './fetch-data';
|
|
|
11
11
|
export * from './fetch-supabase-image';
|
|
12
12
|
export * from './format-date';
|
|
13
13
|
export * from './format-number';
|
|
14
|
+
export * from './format-pricing';
|
|
14
15
|
export * from './format-time';
|
|
15
16
|
export * from './generate-blog-schema';
|
|
16
17
|
export * from './generate-breadcrumb-schema';
|
package/general/index.js
CHANGED
|
@@ -27,6 +27,7 @@ __exportStar(require("./fetch-data"), exports);
|
|
|
27
27
|
__exportStar(require("./fetch-supabase-image"), exports);
|
|
28
28
|
__exportStar(require("./format-date"), exports);
|
|
29
29
|
__exportStar(require("./format-number"), exports);
|
|
30
|
+
__exportStar(require("./format-pricing"), exports);
|
|
30
31
|
__exportStar(require("./format-time"), exports);
|
|
31
32
|
__exportStar(require("./generate-blog-schema"), exports);
|
|
32
33
|
__exportStar(require("./generate-breadcrumb-schema"), exports);
|