@qlibs/utils 1.5.2 → 1.5.3

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.
@@ -1,6 +1,6 @@
1
1
  export declare function formatNumberRange(amountStart: number, amountEnd?: number, locale?: string): string;
2
2
  export declare function formatPriceRange(amountStart: number, amountEnd?: number | undefined, currency?: 'IDR' | 'USD' | 'EUR'): string;
3
- export declare function formatPrice(num: string, currency?: 'IDR' | 'USD' | 'EUR'): string;
3
+ export declare function formatPrice(num: number, currency?: 'IDR' | 'USD' | 'EUR'): string;
4
4
  export declare function parseFormattedPrice(formattedString: string, currency?: 'IDR' | 'USD' | 'EUR'): number;
5
- export declare function formatNumber(num: string | number | undefined, locale?: string, currency?: 'IDR' | 'USD' | 'EUR'): string;
5
+ export declare function formatNumber(num: number, locale?: string, currency?: 'IDR' | 'USD' | 'EUR'): string;
6
6
  export declare function parseFormattedNumber(formattedString: string, locale?: string, currency?: 'IDR' | 'USD' | 'EUR'): number;
@@ -63,12 +63,6 @@ function parseFormattedPrice(formattedString, currency = 'IDR') {
63
63
  return parseFormattedNumber(formattedString, 'id-ID', currency);
64
64
  }
65
65
  function formatNumber(num, locale = 'id-ID', currency) {
66
- if (!num) {
67
- num = 0;
68
- }
69
- if (num && isNaN(Number(num))) {
70
- num = 0;
71
- }
72
66
  if (currency) {
73
67
  return new Intl.NumberFormat(locale, {
74
68
  style: 'currency',
@@ -77,7 +71,7 @@ function formatNumber(num, locale = 'id-ID', currency) {
77
71
  }).format(Number(num));
78
72
  }
79
73
  else {
80
- return new Intl.NumberFormat(locale).format(Number(num));
74
+ return new Intl.NumberFormat(locale).format(num);
81
75
  }
82
76
  }
83
77
  function parseFormattedNumber(formattedString, locale = 'id-ID', currency) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qlibs/utils",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "description": "",
5
5
  "author": "QBIT Developer",
6
6
  "license": "MIT",