@karta.io/utils 0.17.2 → 0.17.4
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/dist/index.cjs +3 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +3 -2
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -11,7 +11,8 @@ function viewExample(value) {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
function formatMoney(value, currency, options = { locale: "en-US", minimumFractionDigits: 2, maximumFractionDigits: 2 }) {
|
|
14
|
-
|
|
14
|
+
let convertedValue = Number(value);
|
|
15
|
+
if (value === null || Number.isNaN(convertedValue)) {
|
|
15
16
|
return "";
|
|
16
17
|
}
|
|
17
18
|
const formatter = new Intl.NumberFormat(options.locale, {
|
|
@@ -22,7 +23,7 @@ function formatMoney(value, currency, options = { locale: "en-US", minimumFracti
|
|
|
22
23
|
currency
|
|
23
24
|
}
|
|
24
25
|
});
|
|
25
|
-
return formatter.format(
|
|
26
|
+
return formatter.format(convertedValue);
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
function createClassName(className) {
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Browser } from 'detect-browser';
|
|
|
2
2
|
|
|
3
3
|
declare function viewExample(value: string): string;
|
|
4
4
|
|
|
5
|
-
declare function formatMoney(value: number | null, currency?: string, options?: {
|
|
5
|
+
declare function formatMoney(value: string | number | null | undefined, currency?: string, options?: {
|
|
6
6
|
locale: string;
|
|
7
7
|
minimumFractionDigits: number;
|
|
8
8
|
maximumFractionDigits: number;
|
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,8 @@ function viewExample(value) {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
function formatMoney(value, currency, options = { locale: "en-US", minimumFractionDigits: 2, maximumFractionDigits: 2 }) {
|
|
10
|
-
|
|
10
|
+
let convertedValue = Number(value);
|
|
11
|
+
if (value === null || Number.isNaN(convertedValue)) {
|
|
11
12
|
return "";
|
|
12
13
|
}
|
|
13
14
|
const formatter = new Intl.NumberFormat(options.locale, {
|
|
@@ -18,7 +19,7 @@ function formatMoney(value, currency, options = { locale: "en-US", minimumFracti
|
|
|
18
19
|
currency
|
|
19
20
|
}
|
|
20
21
|
});
|
|
21
|
-
return formatter.format(
|
|
22
|
+
return formatter.format(convertedValue);
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
function createClassName(className) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@karta.io/utils",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.4",
|
|
4
4
|
"description": "karta.io utils for admin and application",
|
|
5
5
|
"author": "Vitaly Blokhin <karambafe@gmail.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"dist"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@karta.io/common-data": "^0.17.
|
|
23
|
+
"@karta.io/common-data": "^0.17.4",
|
|
24
24
|
"detect-browser": "5.3.0",
|
|
25
25
|
"libphonenumber-js": "1.9.44",
|
|
26
26
|
"lodash-es": "4.17.21"
|