@qrvey/utils 1.16.1-3 → 1.16.1-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/cjs/format/definition.js +1 -1
- package/dist/cjs/format/helpers/getCurrencySymbolByCode.d.ts +1 -0
- package/dist/cjs/format/helpers/getCurrencySymbolByCode.js +10 -2
- package/dist/cjs/format/localization.js +4 -4
- package/dist/format/definition.js +1 -1
- package/dist/format/helpers/getCurrencySymbolByCode.d.ts +1 -0
- package/dist/format/helpers/getCurrencySymbolByCode.js +8 -1
- package/dist/format/localization.js +5 -5
- package/package.json +1 -1
|
@@ -82,7 +82,7 @@ exports.currencyISO = [
|
|
|
82
82
|
{ text: "€ (EUR)", label: "EUR", key: 'eur' },
|
|
83
83
|
{ text: "¥ (JPY)", label: "JPY", key: 'jpy' },
|
|
84
84
|
{ text: "£ (GBP)", label: "GBP", key: 'gbp' },
|
|
85
|
-
{ text:
|
|
85
|
+
{ text: '₩ (KPW)', label: "KPW", key: 'won' },
|
|
86
86
|
{ text: "$ (AUD)", label: "AUD", key: 'aud' },
|
|
87
87
|
{ text: "$ (CAD)", label: "CAD", key: 'cad' },
|
|
88
88
|
{ text: "CHF (CHF)", label: "CHF", key: 'chf' },
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCurrencySymbolByCode = void 0;
|
|
3
|
+
exports.getCurrencySymbolByCode = exports.fixCurrencyFormatOverride = void 0;
|
|
4
4
|
const isEmpty_1 = require("../../general/mix/isEmpty");
|
|
5
|
+
const fixCurrencyFormatOverride = (currencyFormatOverride) => {
|
|
6
|
+
if (currencyFormatOverride === "WON") {
|
|
7
|
+
return "KPW";
|
|
8
|
+
}
|
|
9
|
+
return currencyFormatOverride;
|
|
10
|
+
};
|
|
11
|
+
exports.fixCurrencyFormatOverride = fixCurrencyFormatOverride;
|
|
5
12
|
/**
|
|
6
13
|
* Gets the currency symbol for a given currency code.
|
|
7
14
|
* @param currencyCode The ISO 4217 currency code (e.g., "USD", "EUR").
|
|
@@ -10,10 +17,11 @@ const isEmpty_1 = require("../../general/mix/isEmpty");
|
|
|
10
17
|
function getCurrencySymbolByCode(currencyCode) {
|
|
11
18
|
if ((0, isEmpty_1.isEmpty)(currencyCode))
|
|
12
19
|
return null;
|
|
20
|
+
const fixedCurrencyCode = (0, exports.fixCurrencyFormatOverride)(currencyCode);
|
|
13
21
|
try {
|
|
14
22
|
const parts = new Intl.NumberFormat("en-US", {
|
|
15
23
|
style: "currency",
|
|
16
|
-
currency:
|
|
24
|
+
currency: fixedCurrencyCode,
|
|
17
25
|
currencyDisplay: "narrowSymbol",
|
|
18
26
|
}).formatToParts(1);
|
|
19
27
|
const symbolPart = parts.find((p) => p.type === "currency");
|
|
@@ -70,10 +70,10 @@ function formatLocaleNumber(value, outputFormat, config) {
|
|
|
70
70
|
let langOpts = options || getLocaleOptions(outputFormat);
|
|
71
71
|
const valueToFormat = (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format) === "Percentage" /* LOCALE_FORMATS.PERCENTAGE */ ? value / 100 : value;
|
|
72
72
|
try {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
langOpts = Object.assign(Object.assign({}, langOpts), { currency:
|
|
73
|
+
const fixedCurrencyCode = (0, helpers_1.fixCurrencyFormatOverride)(config.currencyFormatOverride);
|
|
74
|
+
if ((0, isDefaultCurrent_1.isDefaultCurrent)(outputFormat.currency) &&
|
|
75
|
+
!!fixedCurrencyCode) {
|
|
76
|
+
langOpts = Object.assign(Object.assign({}, langOpts), { currency: fixedCurrencyCode });
|
|
77
77
|
}
|
|
78
78
|
const key = (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format) +
|
|
79
79
|
lang +
|
|
@@ -75,7 +75,7 @@ export const currencyISO = [
|
|
|
75
75
|
{ text: "€ (EUR)", label: "EUR", key: 'eur' },
|
|
76
76
|
{ text: "¥ (JPY)", label: "JPY", key: 'jpy' },
|
|
77
77
|
{ text: "£ (GBP)", label: "GBP", key: 'gbp' },
|
|
78
|
-
{ text:
|
|
78
|
+
{ text: '₩ (KPW)', label: "KPW", key: 'won' },
|
|
79
79
|
{ text: "$ (AUD)", label: "AUD", key: 'aud' },
|
|
80
80
|
{ text: "$ (CAD)", label: "CAD", key: 'cad' },
|
|
81
81
|
{ text: "CHF (CHF)", label: "CHF", key: 'chf' },
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { isEmpty } from "../../general/mix/isEmpty";
|
|
2
|
+
export const fixCurrencyFormatOverride = (currencyFormatOverride) => {
|
|
3
|
+
if (currencyFormatOverride === "WON") {
|
|
4
|
+
return "KPW";
|
|
5
|
+
}
|
|
6
|
+
return currencyFormatOverride;
|
|
7
|
+
};
|
|
2
8
|
/**
|
|
3
9
|
* Gets the currency symbol for a given currency code.
|
|
4
10
|
* @param currencyCode The ISO 4217 currency code (e.g., "USD", "EUR").
|
|
@@ -7,10 +13,11 @@ import { isEmpty } from "../../general/mix/isEmpty";
|
|
|
7
13
|
export function getCurrencySymbolByCode(currencyCode) {
|
|
8
14
|
if (isEmpty(currencyCode))
|
|
9
15
|
return null;
|
|
16
|
+
const fixedCurrencyCode = fixCurrencyFormatOverride(currencyCode);
|
|
10
17
|
try {
|
|
11
18
|
const parts = new Intl.NumberFormat("en-US", {
|
|
12
19
|
style: "currency",
|
|
13
|
-
currency:
|
|
20
|
+
currency: fixedCurrencyCode,
|
|
14
21
|
currencyDisplay: "narrowSymbol",
|
|
15
22
|
}).formatToParts(1);
|
|
16
23
|
const symbolPart = parts.find((p) => p.type === "currency");
|
|
@@ -2,7 +2,7 @@ import { ISOToNumericOffset } from "../dates";
|
|
|
2
2
|
import { isEmpty } from "../general/mix/isEmpty";
|
|
3
3
|
import { currencyISO, LANG_DEFAULT, CURRENCY_DEFAULT, DATETIME_OPTIONS, } from "./definition";
|
|
4
4
|
import { DurationFormatter } from "./duration/durationFormatter";
|
|
5
|
-
import {
|
|
5
|
+
import { fixCurrencyFormatOverride } from "./helpers";
|
|
6
6
|
import { isDateTimeFormat } from "./helpers/isDateTimeFormat";
|
|
7
7
|
import { isDefaultCurrent } from "./helpers/isDefaultCurrent";
|
|
8
8
|
export const getLang = (locale) => {
|
|
@@ -64,10 +64,10 @@ function formatLocaleNumber(value, outputFormat, config) {
|
|
|
64
64
|
let langOpts = options || getLocaleOptions(outputFormat);
|
|
65
65
|
const valueToFormat = (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format) === "Percentage" /* LOCALE_FORMATS.PERCENTAGE */ ? value / 100 : value;
|
|
66
66
|
try {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
langOpts = Object.assign(Object.assign({}, langOpts), { currency:
|
|
67
|
+
const fixedCurrencyCode = fixCurrencyFormatOverride(config.currencyFormatOverride);
|
|
68
|
+
if (isDefaultCurrent(outputFormat.currency) &&
|
|
69
|
+
!!fixedCurrencyCode) {
|
|
70
|
+
langOpts = Object.assign(Object.assign({}, langOpts), { currency: fixedCurrencyCode });
|
|
71
71
|
}
|
|
72
72
|
const key = (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format) +
|
|
73
73
|
lang +
|