@uxf/localize 10.0.0-beta.25 → 10.0.0-beta.42

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/README.md CHANGED
@@ -14,14 +14,15 @@ yarn add @uxf/localize
14
14
  npm install @uxf/localize
15
15
  ```
16
16
 
17
- ## Basic usage
17
+ ## Initialize and configure package
18
18
 
19
- ### Initialize and configure package
19
+ ### Configure package
20
20
 
21
21
  ```ts
22
+ // localize.ts
22
23
  import { createLocalize } from "@uxf/localize";
23
- import cs from "@uxf/localize/locale/cs";
24
- import en from "@uxf/localize/locale/en";
24
+ import cs from "@uxf/localize/locale/cs"; // LocalizeConfig
25
+ import en from "@uxf/localize/locale/en"; // LocalizeConfig
25
26
 
26
27
  export const {
27
28
  LocalizeProvider,
@@ -36,31 +37,124 @@ export const {
36
37
  } = createLocale({ cs, en });
37
38
  ```
38
39
 
39
- ### Implement context provider
40
+ ### Localize config examples
40
41
 
41
- use LocalizeProvider in **_app.tsx**
42
+ ```ts
43
+ import {DateTimes, LocalizeConfig} from "@uxf/localize";
44
+
45
+ const en: LocalizeConfig = {
46
+ number: {
47
+ thousandsSeparator: ",",
48
+ decimalSeparator: ".",
49
+ },
50
+ currency: {
51
+ thousandsSeparator: ",",
52
+ decimalSeparator: ".",
53
+ pattern: "!#",
54
+ negativePattern: "-!#",
55
+ },
56
+ dateTime: {
57
+ timeShort: "H:mm A",
58
+ timeFull: "H:mm:ss A",
59
+ dateShort: "M/D/YY",
60
+ dateMedium: "M/D/YYYY",
61
+ dateLong: "MMMM D. YYYY",
62
+ dateShortNoYear: "M/D",
63
+ dateLongNoYear: "MMMM D.",
64
+ dateTimeShort: "M/D/YY H:mm A",
65
+ dateTimeMedium: "M/D/YYYY H:mm A",
66
+ dateTimeLong: "MMMM D. YYYY H:mm:ss A",
67
+ },
68
+ };
69
+
70
+ const cs: LocalizeConfig<DateTimes> = {
71
+ number: {
72
+ thousandsSeparator: "\xa0",
73
+ decimalSeparator: ",",
74
+ },
75
+ currency: {
76
+ thousandsSeparator: "\xa0",
77
+ decimalSeparator: ",",
78
+ pattern: "#\xa0!",
79
+ negativePattern: "-#\xa0!",
80
+ },
81
+ dateTime: {
82
+ timeShort: "H:mm",
83
+ timeFull: "H:mm:ss",
84
+ dateShort: "D. M. YY",
85
+ dateMedium: "D. M. YYYY",
86
+ dateLong: "D. MMMM YYYY",
87
+ dateShortNoYear: "D. M.",
88
+ dateLongNoYear: "D. MMMM",
89
+ dateTimeShort: "D. M. YY, H:mm",
90
+ dateTimeMedium: "D. M. YYYY, H:mm",
91
+ dateTimeLong: "D. MMMM YYYY, H:mm:ss",
92
+ },
93
+ };
94
+ ```
95
+
96
+ ### Add LocalizeProvider to _app.tsx
42
97
 
43
98
  ```tsx
44
- <LocalizeProvider locale="en">{props.children}</LocalizeProvider>
99
+ // _app.tsx
100
+
101
+ <LocalizeProvider locale="cs">{props.children}</LocalizeProvider>
45
102
  ```
46
103
 
47
- ### Format for default locale
104
+ ## Format number
105
+ ```tsx
106
+ const { useFormatNumber } from "./localize";
48
107
 
49
- ```ts
50
- import { useFormatMoney } from "...";
108
+ const formatNumber = useFormatNumber();
109
+
110
+ formatNumber(1000.23); // 1 000
111
+ formatNumber(1000.23, { precision: 2 }); // 1 000,23
112
+ ```
113
+
114
+ ## Format datetime
115
+ ```tsx
116
+ const { useFormatDateTime } from "./localize";
117
+
118
+ const formatDateTime = useFormatDateTime();
119
+
120
+ formatDateTime(new Date('2000-01-01'), "dateShort") // 1. 1. 20
121
+ formatDateTime(new Date('2000-01-01'), "dateTimeMedium") // 1. 1. 2000 00:00
122
+ formatDateTime(new Date('2000-01-01'), "timeFull") // 00:00:00
123
+ ```
124
+
125
+ ## Format money
126
+ ```tsx
127
+ const { useFormatMoney } from "./localize";
51
128
 
52
129
  const formatMoney = useFormatMoney();
53
130
 
54
- formatMoney(5800, "EUR"); // €5.800
131
+ formatMoney(1000, "CZK") // 1 000 Kč
132
+ formatMoney(1000, "USD") // 1 000 $
133
+ formatMoney(1000.23, "CZK", { precision: 1 }) // 1 000,2 Kč
134
+ formatMoney(1000.23, "CZK", { preferIsoCode: true }) // 1 000,23 CZK
135
+ formatMoney(1000.23, "CZK", { hideSymbol: true }) // 1 000,23
55
136
  ```
56
137
 
57
- ### Format for another locale
138
+ ## Format percentage
58
139
 
59
- ```ts
60
- import { formatMoney } from "...";
140
+ ```tsx
141
+ const { useFormatPercentage } from "./localize";
61
142
 
62
- formatMoney("cs", 5800, "EUR"); // 5 800 €
63
- formatMoney("cs", 5800, "EUR", { preferIsoCode: true }); // 5 800 EUR
143
+ const formatPercentage = useFormatPercentage();
144
+
145
+ formatPercentage(0.782) // 78,2 %
146
+ formatPercentage(0.782, "nearest") // 78,2 %
147
+ formatPercentage(0.782, "up") // 78,2 %
148
+ formatPercentage(0.782, "down") // 78,2 %
64
149
  ```
65
150
 
66
- This approach is consistent for all the methods, so you can format numbers, money, percentage and date times.
151
+ ## Format another locale
152
+
153
+ ```tsx
154
+ const { formatNumber, formatDateTime, formatMoney, formatPercentage } from "./localize";
155
+
156
+ formatNumber("cs", 1000.23); // 1 000
157
+ formatDateTime("cs", new Date('2000-01-01'), "dateMedium") // 1. 1. 2000
158
+ formatMoney("cs", 1000, "CZK") // 1 000 Kč
159
+ formatPercentage("cs", 0.782) // 78,2 %
160
+ ```
package/locale/cs.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { LocalizeConfig } from "../src/types";
2
- declare const locale: LocalizeConfig;
1
+ import { DateTimes, LocalizeConfig } from "../src/types";
2
+ declare const locale: LocalizeConfig<DateTimes>;
3
3
  export default locale;
package/locale/de.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { LocalizeConfig } from "../src/types";
2
- declare const locale: LocalizeConfig;
1
+ import { DateTimes, LocalizeConfig } from "../src/types";
2
+ declare const locale: LocalizeConfig<DateTimes>;
3
3
  export default locale;
package/locale/en.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { LocalizeConfig } from "../src/types";
2
- declare const locale: LocalizeConfig;
1
+ import { DateTimes, LocalizeConfig } from "../src/types";
2
+ declare const locale: LocalizeConfig<DateTimes>;
3
3
  export default locale;
package/locale/es.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { LocalizeConfig } from "../src/types";
2
- declare const locale: LocalizeConfig;
1
+ import { DateTimes, LocalizeConfig } from "../src/types";
2
+ declare const locale: LocalizeConfig<DateTimes>;
3
3
  export default locale;
package/locale/fr.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { LocalizeConfig } from "../src/types";
2
- declare const locale: LocalizeConfig;
1
+ import { DateTimes, LocalizeConfig } from "../src/types";
2
+ declare const locale: LocalizeConfig<DateTimes>;
3
3
  export default locale;
package/locale/pl.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { LocalizeConfig } from "../src/types";
2
- declare const locale: LocalizeConfig;
1
+ import { DateTimes, LocalizeConfig } from "../src/types";
2
+ declare const locale: LocalizeConfig<DateTimes>;
3
3
  export default locale;
package/locale/sk.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { LocalizeConfig } from "../src/types";
2
- declare const locale: LocalizeConfig;
1
+ import { DateTimes, LocalizeConfig } from "../src/types";
2
+ declare const locale: LocalizeConfig<DateTimes>;
3
3
  export default locale;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/localize",
3
- "version": "10.0.0-beta.25",
3
+ "version": "10.0.0-beta.42",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { CreateLocalizeProps, DateTimes } from "../types";
2
+ import { LocalizeConfigMap, DateTimes } from "../types";
3
3
  export declare const _useLocalizeContext: () => string;
4
4
  export declare const _LocalizeProvider: import("react").Provider<string>;
5
- export declare const getLocaleConfigHook: <DT extends string = DateTimes>(allConfigurations: CreateLocalizeProps<DT>) => () => import("../types").LocalizeConfig<DT>;
5
+ export declare const getLocaleConfigHook: <DT extends DateTimes, Locales extends string>(allConfigurations: LocalizeConfigMap<DT, Locales>) => () => LocalizeConfigMap<DT, Locales>[Locales];
@@ -1,3 +1,3 @@
1
- import { DateTimes, FormatDatetimeFunction, LocalizeConfig } from "../types";
2
- export declare const _formatDatetime: <DT extends string = DateTimes, Locales extends string = string>(localizeConfigs: Record<Locales, LocalizeConfig<DT>>) => FormatDatetimeFunction<DT, Locales>;
3
- export declare const _useFormatDatetime: <DT extends string = DateTimes>(localizeConfigs: Record<string, LocalizeConfig<DT>>) => () => (value: Date, format: DT) => string;
1
+ import { DateTimes, FormatDatetimeFunction, LocalizeConfigMap } from "../types";
2
+ export declare function createFormatDatetime<DT extends DateTimes, Locales extends string>(localizeConfigs: LocalizeConfigMap<DT, Locales>): FormatDatetimeFunction<DT, Locales>;
3
+ export declare function createUseFormatDatetime<DT extends DateTimes, Locales extends string>(localizeConfigs: LocalizeConfigMap<DT, Locales>): () => (value: Date, format: DT) => string;
@@ -3,17 +3,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports._useFormatDatetime = exports._formatDatetime = void 0;
6
+ exports.createUseFormatDatetime = exports.createFormatDatetime = void 0;
7
7
  const context_1 = require("../context/context");
8
8
  const curry_1 = require("../utils/curry");
9
9
  const dayjs_1 = __importDefault(require("dayjs"));
10
- const _formatDatetime = (localizeConfigs) => (locale, value, format) => {
11
- const localeDateTimes = localizeConfigs[locale].dateTime;
12
- return (0, dayjs_1.default)(value).format(localeDateTimes[format]);
13
- };
14
- exports._formatDatetime = _formatDatetime;
15
- const _useFormatDatetime = (localizeConfigs) => () => {
16
- const locale = (0, context_1._useLocalizeContext)();
17
- return (0, curry_1._curry)((0, exports._formatDatetime)(localizeConfigs))(locale);
18
- };
19
- exports._useFormatDatetime = _useFormatDatetime;
10
+ const react_1 = require("react");
11
+ function createFormatDatetime(localizeConfigs) {
12
+ return (locale, value, format) => {
13
+ const localeDateTimes = localizeConfigs[locale].dateTime;
14
+ return (0, dayjs_1.default)(value).format(localeDateTimes[format]);
15
+ };
16
+ }
17
+ exports.createFormatDatetime = createFormatDatetime;
18
+ function createUseFormatDatetime(localizeConfigs) {
19
+ return () => {
20
+ const locale = (0, context_1._useLocalizeContext)();
21
+ return (0, react_1.useMemo)(() => (0, curry_1._curry)(createFormatDatetime(localizeConfigs))(locale), [locale]);
22
+ };
23
+ }
24
+ exports.createUseFormatDatetime = createUseFormatDatetime;
@@ -8,7 +8,7 @@ const cs_1 = __importDefault(require("../../locale/cs"));
8
8
  const en_1 = __importDefault(require("../../locale/en"));
9
9
  const date = new Date("2023-07-21T07:58:35");
10
10
  describe("datetime formatter", function () {
11
- const formatDatetimeWithLocales = (0, format_datetime_1._formatDatetime)({ cs: cs_1.default, en: en_1.default });
11
+ const formatDatetimeWithLocales = (0, format_datetime_1.createFormatDatetime)({ cs: cs_1.default, en: en_1.default });
12
12
  it("format datetime with 'en' locale", function () {
13
13
  expect(formatDatetimeWithLocales("cs", date, "dateShort")).toBe("21. 7. 23");
14
14
  expect(formatDatetimeWithLocales("cs", date, "dateMedium")).toBe("21. 7. 2023");
@@ -1,3 +1,3 @@
1
- import { DateTimes, FormatMoneyFunction, LocalizeConfig } from "../types";
2
- export declare const _formatMoney: <DT extends string = DateTimes, Locales extends string = string>(localizeConfigs: Record<Locales, LocalizeConfig<DT>>) => FormatMoneyFunction<Locales>;
3
- export declare const _useFormatMoney: <DT extends string = DateTimes>(localizeConfigs: Record<string, LocalizeConfig<DT>>) => () => (value: number, currency: "CHF" | "AED" | "AFN" | "AMD" | "ANG" | "ARS" | "AUD" | "AWG" | "AZN" | "BDT" | "BGN" | "BHD" | "BIF" | "BRL" | "BTN" | "BYN" | "CAD" | "CLP" | "CNY" | "COP" | "CRC" | "CUP" | "CVE" | "CZK" | "DJF" | "DKK" | "EGP" | "ERN" | "EUR" | "FJD" | "GBP" | "GEL" | "GMD" | "GNF" | "HKD" | "HRK" | "HTG" | "HUF" | "IDR" | "INR" | "IQD" | "ISK" | "JPY" | "KGS" | "KHR" | "KMF" | "KRW" | "KWD" | "KZT" | "LKR" | "LRD" | "LSL" | "MDL" | "MMK" | "MNT" | "MRO" | "MWK" | "MXN" | "MYR" | "MZN" | "NGN" | "NOK" | "NPR" | "NZD" | "PEN" | "PGK" | "PHP" | "PKR" | "PLN" | "PYG" | "RON" | "RSD" | "RUB" | "SBD" | "SDG" | "SEK" | "SGD" | "SLL" | "SRD" | "SYP" | "SZL" | "THB" | "TJS" | "TMT" | "TRY" | "TZS" | "UGX" | "USD" | "UYU" | "UZS" | "VES" | "VND" | "VUV" | "WST" | "XOF" | "XPF" | "YER" | "ZAR" | "ZMW", options?: import("../types").FormatMoneyOptions | undefined) => string;
1
+ import { DateTimes, FormatMoneyFunction, LocalizeConfigMap } from "../types";
2
+ export declare function createFormatMoney<DT extends DateTimes, Locales extends string>(localizeConfigs: LocalizeConfigMap<DT, Locales>): FormatMoneyFunction<Locales>;
3
+ export declare function createUseFormatMoney<DT extends DateTimes, Locales extends string>(localizeConfigs: LocalizeConfigMap<DT, Locales>): () => (value: number, currency: "CHF" | "AED" | "AFN" | "ALL" | "AMD" | "ANG" | "AOA" | "ARS" | "AUD" | "AWG" | "AZN" | "BAM" | "BBD" | "BDT" | "BGN" | "BHD" | "BIF" | "BMD" | "BND" | "BOB" | "BOV" | "BRL" | "BSD" | "BTN" | "BWP" | "BYN" | "BZD" | "CAD" | "CDF" | "CHE" | "CHW" | "CLF" | "CLP" | "CNY" | "COP" | "COU" | "CRC" | "CUC" | "CUP" | "CVE" | "CZK" | "DJF" | "DKK" | "DOP" | "DZD" | "EGP" | "ERN" | "ETB" | "EUR" | "FJD" | "FKP" | "GBP" | "GEL" | "GHS" | "GIP" | "GMD" | "GNF" | "GTQ" | "GYD" | "HKD" | "HNL" | "HTG" | "HUF" | "IDR" | "ILS" | "INR" | "IQD" | "IRR" | "ISK" | "JMD" | "JOD" | "JPY" | "KES" | "KGS" | "KHR" | "KMF" | "KPW" | "KRW" | "KWD" | "KYD" | "KZT" | "LAK" | "LBP" | "LKR" | "LRD" | "LSL" | "LYD" | "MAD" | "MDL" | "MGA" | "MKD" | "MMK" | "MNT" | "MOP" | "MRU" | "MUR" | "MVR" | "MWK" | "MXN" | "MXV" | "MYR" | "MZN" | "NAD" | "NGN" | "NIO" | "NOK" | "NPR" | "NZD" | "OMR" | "PAB" | "PEN" | "PGK" | "PHP" | "PKR" | "PLN" | "PYG" | "QAR" | "RON" | "RSD" | "RUB" | "RWF" | "SAR" | "SBD" | "SCR" | "SDG" | "SEK" | "SGD" | "SHP" | "SLE" | "SLL" | "SOS" | "SRD" | "SSP" | "STN" | "SVC" | "SYP" | "SZL" | "THB" | "TJS" | "TMT" | "TND" | "TOP" | "TRY" | "TTD" | "TWD" | "TZS" | "UAH" | "UGX" | "USD" | "USN" | "UYI" | "UYU" | "UYW" | "UZS" | "VED" | "VES" | "VND" | "VUV" | "WST" | "XAF" | "XCD" | "XOF" | "XPF" | "YER" | "ZAR" | "ZMW" | "ZWL", options?: import("../types").FormatMoneyOptions | undefined) => string;
@@ -3,26 +3,31 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports._useFormatMoney = exports._formatMoney = void 0;
6
+ exports.createUseFormatMoney = exports.createFormatMoney = void 0;
7
7
  const context_1 = require("../context/context");
8
8
  const curry_1 = require("../utils/curry");
9
9
  const currency_js_1 = __importDefault(require("currency.js"));
10
10
  const map_options_1 = require("../utils/map-options");
11
11
  const data_1 = require("../utils/data");
12
- const _formatMoney = (localizeConfigs) => (locale, value, currency, options) => {
13
- var _a, _b, _c;
14
- const precision = (_a = options === null || options === void 0 ? void 0 : options.precision) !== null && _a !== void 0 ? _a : 0;
15
- const symbol = (options === null || options === void 0 ? void 0 : options.preferIsoCode) ? currency : data_1.CURRENCIES[currency].symbol;
16
- const formatOptions = { ...(0, map_options_1._mapOptions)(localizeConfigs[locale].currency), precision, symbol };
17
- if (options === null || options === void 0 ? void 0 : options.hideSymbol) {
18
- formatOptions.pattern = (_b = formatOptions.pattern) === null || _b === void 0 ? void 0 : _b.replace("!", "").trim();
19
- formatOptions.negativePattern = (_c = formatOptions.negativePattern) === null || _c === void 0 ? void 0 : _c.replace("!", "").trim();
20
- }
21
- return (0, currency_js_1.default)(value, { precision }).format(formatOptions);
22
- };
23
- exports._formatMoney = _formatMoney;
24
- const _useFormatMoney = (localizeConfigs) => () => {
25
- const locale = (0, context_1._useLocalizeContext)();
26
- return (0, curry_1._curry)((0, exports._formatMoney)(localizeConfigs))(locale);
27
- };
28
- exports._useFormatMoney = _useFormatMoney;
12
+ const react_1 = require("react");
13
+ function createFormatMoney(localizeConfigs) {
14
+ return (locale, value, currency, options) => {
15
+ var _a, _b, _c;
16
+ const precision = (_a = options === null || options === void 0 ? void 0 : options.precision) !== null && _a !== void 0 ? _a : 0;
17
+ const symbol = (options === null || options === void 0 ? void 0 : options.preferIsoCode) ? currency : data_1.CURRENCIES[currency].symbol;
18
+ const formatOptions = { ...(0, map_options_1._mapOptions)(localizeConfigs[locale].currency), precision, symbol };
19
+ if (options === null || options === void 0 ? void 0 : options.hideSymbol) {
20
+ formatOptions.pattern = (_b = formatOptions.pattern) === null || _b === void 0 ? void 0 : _b.replace("!", "").trim();
21
+ formatOptions.negativePattern = (_c = formatOptions.negativePattern) === null || _c === void 0 ? void 0 : _c.replace("!", "").trim();
22
+ }
23
+ return (0, currency_js_1.default)(value, { precision }).format(formatOptions);
24
+ };
25
+ }
26
+ exports.createFormatMoney = createFormatMoney;
27
+ function createUseFormatMoney(localizeConfigs) {
28
+ return () => {
29
+ const locale = (0, context_1._useLocalizeContext)();
30
+ return (0, react_1.useMemo)(() => (0, curry_1._curry)(createFormatMoney(localizeConfigs))(locale), [locale]);
31
+ };
32
+ }
33
+ exports.createUseFormatMoney = createUseFormatMoney;
@@ -7,7 +7,7 @@ const format_money_1 = require("./format-money");
7
7
  const cs_1 = __importDefault(require("../../locale/cs"));
8
8
  const en_1 = __importDefault(require("../../locale/en"));
9
9
  describe("money formatter", function () {
10
- const formatMoneyWithLocales = (0, format_money_1._formatMoney)({ cs: cs_1.default, en: en_1.default });
10
+ const formatMoneyWithLocales = (0, format_money_1.createFormatMoney)({ cs: cs_1.default, en: en_1.default });
11
11
  it("format money with 'cs' locale", function () {
12
12
  expect(formatMoneyWithLocales("cs", 2000.78, "CZK")).toBe("2\xa0001\xa0Kč");
13
13
  expect(formatMoneyWithLocales("cs", 2000.78, "CZK", { precision: 1 })).toBe("2\xa0000,8\xa0Kč");
@@ -1,3 +1,3 @@
1
- import { DateTimes, FormatNumberFunction, LocalizeConfig } from "../types";
2
- export declare const _formatNumber: <DT extends string = DateTimes, Locales extends string = string>(localizeConfigs: Record<Locales, LocalizeConfig<DT>>) => FormatNumberFunction<Locales>;
3
- export declare const _useFormatNumber: <DT extends string = DateTimes>(localizeConfigs: Record<string, LocalizeConfig<DT>>) => () => (value: number, options?: import("../types").FormatNumberOptions | undefined) => string;
1
+ import { DateTimes, FormatNumberFunction, LocalizeConfigMap } from "../types";
2
+ export declare function createFormatNumber<DT extends DateTimes, Locales extends string>(localizeConfigs: LocalizeConfigMap<DT, Locales>): FormatNumberFunction<Locales>;
3
+ export declare function createUseFormatNumber<DT extends DateTimes, Locales extends string>(localizeConfigs: LocalizeConfigMap<DT, Locales>): () => (value: number, options?: import("../types").FormatNumberOptions | undefined) => string;
@@ -3,20 +3,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports._useFormatNumber = exports._formatNumber = void 0;
6
+ exports.createUseFormatNumber = exports.createFormatNumber = void 0;
7
7
  const currency_js_1 = __importDefault(require("currency.js"));
8
8
  const context_1 = require("../context/context");
9
9
  const curry_1 = require("../utils/curry");
10
10
  const map_options_1 = require("../utils/map-options");
11
- const _formatNumber = (localizeConfigs) => (locale, value, options) => {
12
- var _a;
13
- const precision = (_a = options === null || options === void 0 ? void 0 : options.precision) !== null && _a !== void 0 ? _a : 0;
14
- const formatOptions = { ...(0, map_options_1._mapOptions)(localizeConfigs[locale].number), precision };
15
- return (0, currency_js_1.default)(value, { precision }).format(formatOptions);
16
- };
17
- exports._formatNumber = _formatNumber;
18
- const _useFormatNumber = (localizeConfigs) => () => {
19
- const locale = (0, context_1._useLocalizeContext)();
20
- return (0, curry_1._curry)((0, exports._formatNumber)(localizeConfigs))(locale);
21
- };
22
- exports._useFormatNumber = _useFormatNumber;
11
+ const react_1 = require("react");
12
+ function createFormatNumber(localizeConfigs) {
13
+ return (locale, value, options) => {
14
+ var _a;
15
+ const precision = (_a = options === null || options === void 0 ? void 0 : options.precision) !== null && _a !== void 0 ? _a : 0;
16
+ const formatOptions = { ...(0, map_options_1._mapOptions)(localizeConfigs[locale].number), precision };
17
+ return (0, currency_js_1.default)(value, { precision }).format(formatOptions);
18
+ };
19
+ }
20
+ exports.createFormatNumber = createFormatNumber;
21
+ function createUseFormatNumber(localizeConfigs) {
22
+ return () => {
23
+ const locale = (0, context_1._useLocalizeContext)();
24
+ return (0, react_1.useMemo)(() => (0, curry_1._curry)(createFormatNumber(localizeConfigs))(locale), [locale]);
25
+ };
26
+ }
27
+ exports.createUseFormatNumber = createUseFormatNumber;
@@ -7,7 +7,7 @@ const format_number_1 = require("./format-number");
7
7
  const cs_1 = __importDefault(require("../../locale/cs"));
8
8
  const en_1 = __importDefault(require("../../locale/en"));
9
9
  describe("number formatter", function () {
10
- const formatNumberWithLocales = (0, format_number_1._formatNumber)({ cs: cs_1.default, en: en_1.default });
10
+ const formatNumberWithLocales = (0, format_number_1.createFormatNumber)({ cs: cs_1.default, en: en_1.default });
11
11
  it("format number with 'cs' locale", function () {
12
12
  expect(formatNumberWithLocales("cs", 2000.78)).toBe("2\xa0001");
13
13
  expect(formatNumberWithLocales("cs", 2000.78, { precision: 2 })).toBe("2\xa0000,78");
@@ -1,3 +1,3 @@
1
- import { DateTimes, FormatPercentageFunction, LocalizeConfig, RoundingType } from "../types";
2
- export declare const _formatPercentage: <DT extends string = DateTimes, Locales extends string = string>(localizeConfigs: Record<Locales, LocalizeConfig<DT>>) => FormatPercentageFunction<Locales>;
3
- export declare const _useFormatPercentage: <DT extends string = DateTimes>(localizeConfigs: Record<string, LocalizeConfig<DT>>) => () => (value: number, roundingType?: RoundingType | null | undefined, options?: import("../types").FormatPercentageOptions | undefined) => string;
1
+ import { DateTimes, FormatPercentageFunction, LocalizeConfigMap, RoundingType } from "../types";
2
+ export declare function createFormatPercentage<DT extends DateTimes, Locales extends string>(localizeConfigs: LocalizeConfigMap<DT, Locales>): FormatPercentageFunction<Locales>;
3
+ export declare function createUseFormatPercentage<DT extends DateTimes, Locales extends string>(localizeConfigs: LocalizeConfigMap<DT, Locales>): () => (value: number, roundingType?: RoundingType | null | undefined, options?: import("../types").FormatPercentageOptions | undefined) => string;
@@ -1,23 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._useFormatPercentage = exports._formatPercentage = void 0;
3
+ exports.createUseFormatPercentage = exports.createFormatPercentage = void 0;
4
4
  const format_number_1 = require("../format-number/format-number");
5
5
  const context_1 = require("../context/context");
6
6
  const curry_1 = require("../utils/curry");
7
+ const react_1 = require("react");
7
8
  const ROUND_FUNCTION_MAP = {
8
9
  nearest: Math.round,
9
10
  up: Math.ceil,
10
11
  down: Math.floor,
11
12
  };
12
13
  const PERCENTAGE_MULTIPLIER = 100;
13
- const _formatPercentage = (localizeConfigs) => (locale, value, roundingType = null, options) => {
14
- const percentage = value * PERCENTAGE_MULTIPLIER;
15
- const percentageValue = roundingType ? ROUND_FUNCTION_MAP[roundingType](percentage) : percentage;
16
- return `${(0, format_number_1._formatNumber)(localizeConfigs)(locale, percentageValue, options)}\xa0%`;
17
- };
18
- exports._formatPercentage = _formatPercentage;
19
- const _useFormatPercentage = (localizeConfigs) => () => {
20
- const locale = (0, context_1._useLocalizeContext)();
21
- return (0, curry_1._curry)((0, exports._formatPercentage)(localizeConfigs))(locale);
22
- };
23
- exports._useFormatPercentage = _useFormatPercentage;
14
+ function createFormatPercentage(localizeConfigs) {
15
+ return (locale, value, roundingType = null, options) => {
16
+ const percentage = value * PERCENTAGE_MULTIPLIER;
17
+ const percentageValue = roundingType ? ROUND_FUNCTION_MAP[roundingType](percentage) : percentage;
18
+ return `${(0, format_number_1.createFormatNumber)(localizeConfigs)(locale, percentageValue, options)}\xa0%`;
19
+ };
20
+ }
21
+ exports.createFormatPercentage = createFormatPercentage;
22
+ function createUseFormatPercentage(localizeConfigs) {
23
+ return () => {
24
+ const locale = (0, context_1._useLocalizeContext)();
25
+ return (0, react_1.useMemo)(() => (0, curry_1._curry)(createFormatPercentage(localizeConfigs))(locale), [locale]);
26
+ };
27
+ }
28
+ exports.createUseFormatPercentage = createUseFormatPercentage;
@@ -7,7 +7,7 @@ const format_percentage_1 = require("./format-percentage");
7
7
  const cs_1 = __importDefault(require("../../locale/cs"));
8
8
  const en_1 = __importDefault(require("../../locale/en"));
9
9
  describe("percentage formatter", function () {
10
- const formatPercentageWithLocales = (0, format_percentage_1._formatPercentage)({ cs: cs_1.default, en: en_1.default });
10
+ const formatPercentageWithLocales = (0, format_percentage_1.createFormatPercentage)({ cs: cs_1.default, en: en_1.default });
11
11
  it("format percentage with 'cs' locale", function () {
12
12
  expect(formatPercentageWithLocales("cs", 0.782)).toBe("78\xa0%");
13
13
  expect(formatPercentageWithLocales("cs", 0.782, null, { precision: 2 })).toBe("78,20\xa0%");
package/src/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { CreateLocalizeProps, CreateLocalizeReturn, DateTimes } from "./types";
1
+ import { LocalizeConfigMap, CreateLocalizeReturn, DateTimes } from "./types";
2
2
  export * from "./get-currency-symbol/get-currency-symbol";
3
- export declare function createLocalize<DT extends string = DateTimes, Locales extends string = string>(props: CreateLocalizeProps<DT, Locales>): CreateLocalizeReturn<DT, Locales>;
3
+ export declare function createLocalize<DT extends DateTimes, Locales extends string>(config: LocalizeConfigMap<DT, Locales>): CreateLocalizeReturn<DT, Locales>;
package/src/index.js CHANGED
@@ -21,18 +21,18 @@ const format_percentage_1 = require("./format-percentage/format-percentage");
21
21
  const format_datetime_1 = require("./format-datetime/format-datetime");
22
22
  const format_money_1 = require("./format-money/format-money");
23
23
  __exportStar(require("./get-currency-symbol/get-currency-symbol"), exports);
24
- function createLocalize(props) {
24
+ function createLocalize(config) {
25
25
  return {
26
26
  LocalizeProvider: context_1._LocalizeProvider,
27
- formatDateTime: (0, format_datetime_1._formatDatetime)(props),
28
- formatNumber: (0, format_number_1._formatNumber)(props),
29
- formatPercentage: (0, format_percentage_1._formatPercentage)(props),
30
- formatMoney: (0, format_money_1._formatMoney)(props),
31
- useFormatDateTime: (0, format_datetime_1._useFormatDatetime)(props),
32
- useFormatNumber: (0, format_number_1._useFormatNumber)(props),
33
- useFormatPercentage: (0, format_percentage_1._useFormatPercentage)(props),
34
- useFormatMoney: (0, format_money_1._useFormatMoney)(props),
35
- useLocaleConfig: (0, context_1.getLocaleConfigHook)(props),
27
+ formatDateTime: (0, format_datetime_1.createFormatDatetime)(config),
28
+ formatNumber: (0, format_number_1.createFormatNumber)(config),
29
+ formatPercentage: (0, format_percentage_1.createFormatPercentage)(config),
30
+ formatMoney: (0, format_money_1.createFormatMoney)(config),
31
+ useFormatDateTime: (0, format_datetime_1.createUseFormatDatetime)(config),
32
+ useFormatNumber: (0, format_number_1.createUseFormatNumber)(config),
33
+ useFormatPercentage: (0, format_percentage_1.createUseFormatPercentage)(config),
34
+ useFormatMoney: (0, format_money_1.createUseFormatMoney)(config),
35
+ useLocaleConfig: (0, context_1.getLocaleConfigHook)(config),
36
36
  };
37
37
  }
38
38
  exports.createLocalize = createLocalize;
package/src/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { CURRENCIES } from "./utils/data";
2
2
  import { Provider } from "react";
3
3
  export type DateTimes = "timeShort" | "timeFull" | "dateShort" | "dateMedium" | "dateLong" | "dateShortNoYear" | "dateLongNoYear" | "dateTimeShort" | "dateTimeMedium" | "dateTimeLong";
4
- export type LocalizeConfig<DT extends string = DateTimes> = {
4
+ export type LocalizeConfig<DT extends DateTimes> = {
5
5
  number: {
6
6
  thousandsSeparator: string;
7
7
  decimalSeparator: string;
@@ -14,18 +14,18 @@ export type LocalizeConfig<DT extends string = DateTimes> = {
14
14
  };
15
15
  dateTime: Record<DT, string>;
16
16
  };
17
+ export type LocalizeConfigMap<DT extends DateTimes, Locales extends string> = Record<Locales, LocalizeConfig<DT>>;
17
18
  export type LocalizeProviderType = Provider<string>;
18
- export type UseLocaleConfigType<DT extends string = DateTimes> = () => LocalizeConfig<DT>;
19
+ export type UseLocaleConfigType<DT extends DateTimes> = () => LocalizeConfig<DT>;
19
20
  export type FormatNumberFunction<Locales extends string> = (locale: Locales, value: number, options?: FormatNumberOptions) => string;
20
21
  export type UseFormatNumberFunction = () => (value: number, options?: FormatNumberOptions) => string;
21
22
  export type FormatMoneyFunction<Locales extends string> = (locale: Locales, value: number, currency: Currency, options?: FormatMoneyOptions) => string;
22
23
  export type UseFormatMoneyFunction = () => (value: number, currency: Currency, options?: FormatMoneyOptions) => string;
23
24
  export type FormatPercentageFunction<Locales extends string> = (locale: Locales, value: number, roundingType?: RoundingType | null, options?: FormatPercentageOptions) => string;
24
25
  export type UseFormatPercentageFunction = () => (value: number, roundingType?: RoundingType | null, options?: FormatPercentageOptions) => string;
25
- export type FormatDatetimeFunction<DT extends string = DateTimes, Locales extends string = string> = (locale: Locales, value: Date, format: DT) => string;
26
- export type UseFormatDatetimeFunction<DT extends string = DateTimes> = () => (value: Date, format: DT) => string;
27
- export type CreateLocalizeProps<DT extends string = DateTimes, Locales extends string = string> = Record<Locales, LocalizeConfig<DT>>;
28
- export type CreateLocalizeReturn<DT extends string = DateTimes, Locales extends string = string> = {
26
+ export type FormatDatetimeFunction<DT extends DateTimes, Locales extends string> = (locale: Locales, value: Date, format: DT) => string;
27
+ export type UseFormatDatetimeFunction<DT extends DateTimes> = () => (value: Date, format: DT) => string;
28
+ export type CreateLocalizeReturn<DT extends DateTimes, Locales extends string> = {
29
29
  LocalizeProvider: LocalizeProviderType;
30
30
  useLocaleConfig: UseLocaleConfigType<DT>;
31
31
  formatNumber: FormatNumberFunction<Locales>;
@@ -5,12 +5,18 @@ export declare const CURRENCIES: {
5
5
  AFN: {
6
6
  symbol: string;
7
7
  };
8
+ ALL: {
9
+ symbol: string;
10
+ };
8
11
  AMD: {
9
12
  symbol: string;
10
13
  };
11
14
  ANG: {
12
15
  symbol: string;
13
16
  };
17
+ AOA: {
18
+ symbol: string;
19
+ };
14
20
  ARS: {
15
21
  symbol: string;
16
22
  };
@@ -23,6 +29,12 @@ export declare const CURRENCIES: {
23
29
  AZN: {
24
30
  symbol: string;
25
31
  };
32
+ BAM: {
33
+ symbol: string;
34
+ };
35
+ BBD: {
36
+ symbol: string;
37
+ };
26
38
  BDT: {
27
39
  symbol: string;
28
40
  };
@@ -35,21 +47,54 @@ export declare const CURRENCIES: {
35
47
  BIF: {
36
48
  symbol: string;
37
49
  };
50
+ BMD: {
51
+ symbol: string;
52
+ };
53
+ BND: {
54
+ symbol: string;
55
+ };
56
+ BOB: {
57
+ symbol: string;
58
+ };
59
+ BOV: {
60
+ symbol: string;
61
+ };
38
62
  BRL: {
39
63
  symbol: string;
40
64
  };
65
+ BSD: {
66
+ symbol: string;
67
+ };
41
68
  BTN: {
42
69
  symbol: string;
43
70
  };
71
+ BWP: {
72
+ symbol: string;
73
+ };
44
74
  BYN: {
45
75
  symbol: string;
46
76
  };
77
+ BZD: {
78
+ symbol: string;
79
+ };
47
80
  CAD: {
48
81
  symbol: string;
49
82
  };
83
+ CDF: {
84
+ symbol: string;
85
+ };
86
+ CHE: {
87
+ symbol: string;
88
+ };
50
89
  CHF: {
51
90
  symbol: string;
52
91
  };
92
+ CHW: {
93
+ symbol: string;
94
+ };
95
+ CLF: {
96
+ symbol: string;
97
+ };
53
98
  CLP: {
54
99
  symbol: string;
55
100
  };
@@ -59,9 +104,15 @@ export declare const CURRENCIES: {
59
104
  COP: {
60
105
  symbol: string;
61
106
  };
107
+ COU: {
108
+ symbol: string;
109
+ };
62
110
  CRC: {
63
111
  symbol: string;
64
112
  };
113
+ CUC: {
114
+ symbol: string;
115
+ };
65
116
  CUP: {
66
117
  symbol: string;
67
118
  };
@@ -77,34 +128,58 @@ export declare const CURRENCIES: {
77
128
  DKK: {
78
129
  symbol: string;
79
130
  };
131
+ DOP: {
132
+ symbol: string;
133
+ };
134
+ DZD: {
135
+ symbol: string;
136
+ };
80
137
  EGP: {
81
138
  symbol: string;
82
139
  };
83
140
  ERN: {
84
141
  symbol: string;
85
142
  };
143
+ ETB: {
144
+ symbol: string;
145
+ };
86
146
  EUR: {
87
147
  symbol: string;
88
148
  };
89
149
  FJD: {
90
150
  symbol: string;
91
151
  };
152
+ FKP: {
153
+ symbol: string;
154
+ };
92
155
  GBP: {
93
156
  symbol: string;
94
157
  };
95
158
  GEL: {
96
159
  symbol: string;
97
160
  };
161
+ GHS: {
162
+ symbol: string;
163
+ };
164
+ GIP: {
165
+ symbol: string;
166
+ };
98
167
  GMD: {
99
168
  symbol: string;
100
169
  };
101
170
  GNF: {
102
171
  symbol: string;
103
172
  };
173
+ GTQ: {
174
+ symbol: string;
175
+ };
176
+ GYD: {
177
+ symbol: string;
178
+ };
104
179
  HKD: {
105
180
  symbol: string;
106
181
  };
107
- HRK: {
182
+ HNL: {
108
183
  symbol: string;
109
184
  };
110
185
  HTG: {
@@ -116,18 +191,33 @@ export declare const CURRENCIES: {
116
191
  IDR: {
117
192
  symbol: string;
118
193
  };
194
+ ILS: {
195
+ symbol: string;
196
+ };
119
197
  INR: {
120
198
  symbol: string;
121
199
  };
122
200
  IQD: {
123
201
  symbol: string;
124
202
  };
203
+ IRR: {
204
+ symbol: string;
205
+ };
125
206
  ISK: {
126
207
  symbol: string;
127
208
  };
209
+ JMD: {
210
+ symbol: string;
211
+ };
212
+ JOD: {
213
+ symbol: string;
214
+ };
128
215
  JPY: {
129
216
  symbol: string;
130
217
  };
218
+ KES: {
219
+ symbol: string;
220
+ };
131
221
  KGS: {
132
222
  symbol: string;
133
223
  };
@@ -137,15 +227,27 @@ export declare const CURRENCIES: {
137
227
  KMF: {
138
228
  symbol: string;
139
229
  };
230
+ KPW: {
231
+ symbol: string;
232
+ };
140
233
  KRW: {
141
234
  symbol: string;
142
235
  };
143
236
  KWD: {
144
237
  symbol: string;
145
238
  };
239
+ KYD: {
240
+ symbol: string;
241
+ };
146
242
  KZT: {
147
243
  symbol: string;
148
244
  };
245
+ LAK: {
246
+ symbol: string;
247
+ };
248
+ LBP: {
249
+ symbol: string;
250
+ };
149
251
  LKR: {
150
252
  symbol: string;
151
253
  };
@@ -155,16 +257,37 @@ export declare const CURRENCIES: {
155
257
  LSL: {
156
258
  symbol: string;
157
259
  };
260
+ LYD: {
261
+ symbol: string;
262
+ };
263
+ MAD: {
264
+ symbol: string;
265
+ };
158
266
  MDL: {
159
267
  symbol: string;
160
268
  };
269
+ MGA: {
270
+ symbol: string;
271
+ };
272
+ MKD: {
273
+ symbol: string;
274
+ };
161
275
  MMK: {
162
276
  symbol: string;
163
277
  };
164
278
  MNT: {
165
279
  symbol: string;
166
280
  };
167
- MRO: {
281
+ MOP: {
282
+ symbol: string;
283
+ };
284
+ MRU: {
285
+ symbol: string;
286
+ };
287
+ MUR: {
288
+ symbol: string;
289
+ };
290
+ MVR: {
168
291
  symbol: string;
169
292
  };
170
293
  MWK: {
@@ -173,15 +296,24 @@ export declare const CURRENCIES: {
173
296
  MXN: {
174
297
  symbol: string;
175
298
  };
299
+ MXV: {
300
+ symbol: string;
301
+ };
176
302
  MYR: {
177
303
  symbol: string;
178
304
  };
179
305
  MZN: {
180
306
  symbol: string;
181
307
  };
308
+ NAD: {
309
+ symbol: string;
310
+ };
182
311
  NGN: {
183
312
  symbol: string;
184
313
  };
314
+ NIO: {
315
+ symbol: string;
316
+ };
185
317
  NOK: {
186
318
  symbol: string;
187
319
  };
@@ -191,6 +323,12 @@ export declare const CURRENCIES: {
191
323
  NZD: {
192
324
  symbol: string;
193
325
  };
326
+ OMR: {
327
+ symbol: string;
328
+ };
329
+ PAB: {
330
+ symbol: string;
331
+ };
194
332
  PEN: {
195
333
  symbol: string;
196
334
  };
@@ -209,6 +347,9 @@ export declare const CURRENCIES: {
209
347
  PYG: {
210
348
  symbol: string;
211
349
  };
350
+ QAR: {
351
+ symbol: string;
352
+ };
212
353
  RON: {
213
354
  symbol: string;
214
355
  };
@@ -218,9 +359,18 @@ export declare const CURRENCIES: {
218
359
  RUB: {
219
360
  symbol: string;
220
361
  };
362
+ RWF: {
363
+ symbol: string;
364
+ };
365
+ SAR: {
366
+ symbol: string;
367
+ };
221
368
  SBD: {
222
369
  symbol: string;
223
370
  };
371
+ SCR: {
372
+ symbol: string;
373
+ };
224
374
  SDG: {
225
375
  symbol: string;
226
376
  };
@@ -230,12 +380,30 @@ export declare const CURRENCIES: {
230
380
  SGD: {
231
381
  symbol: string;
232
382
  };
383
+ SHP: {
384
+ symbol: string;
385
+ };
386
+ SLE: {
387
+ symbol: string;
388
+ };
233
389
  SLL: {
234
390
  symbol: string;
235
391
  };
392
+ SOS: {
393
+ symbol: string;
394
+ };
236
395
  SRD: {
237
396
  symbol: string;
238
397
  };
398
+ SSP: {
399
+ symbol: string;
400
+ };
401
+ STN: {
402
+ symbol: string;
403
+ };
404
+ SVC: {
405
+ symbol: string;
406
+ };
239
407
  SYP: {
240
408
  symbol: string;
241
409
  };
@@ -251,24 +419,51 @@ export declare const CURRENCIES: {
251
419
  TMT: {
252
420
  symbol: string;
253
421
  };
422
+ TND: {
423
+ symbol: string;
424
+ };
425
+ TOP: {
426
+ symbol: string;
427
+ };
254
428
  TRY: {
255
429
  symbol: string;
256
430
  };
431
+ TTD: {
432
+ symbol: string;
433
+ };
434
+ TWD: {
435
+ symbol: string;
436
+ };
257
437
  TZS: {
258
438
  symbol: string;
259
439
  };
440
+ UAH: {
441
+ symbol: string;
442
+ };
260
443
  UGX: {
261
444
  symbol: string;
262
445
  };
263
446
  USD: {
264
447
  symbol: string;
265
448
  };
449
+ USN: {
450
+ symbol: string;
451
+ };
452
+ UYI: {
453
+ symbol: string;
454
+ };
266
455
  UYU: {
267
456
  symbol: string;
268
457
  };
458
+ UYW: {
459
+ symbol: string;
460
+ };
269
461
  UZS: {
270
462
  symbol: string;
271
463
  };
464
+ VED: {
465
+ symbol: string;
466
+ };
272
467
  VES: {
273
468
  symbol: string;
274
469
  };
@@ -281,6 +476,12 @@ export declare const CURRENCIES: {
281
476
  WST: {
282
477
  symbol: string;
283
478
  };
479
+ XAF: {
480
+ symbol: string;
481
+ };
482
+ XCD: {
483
+ symbol: string;
484
+ };
284
485
  XOF: {
285
486
  symbol: string;
286
487
  };
@@ -296,4 +497,7 @@ export declare const CURRENCIES: {
296
497
  ZMW: {
297
498
  symbol: string;
298
499
  };
500
+ ZWL: {
501
+ symbol: string;
502
+ };
299
503
  };
package/src/utils/data.js CHANGED
@@ -4,101 +4,169 @@ exports.CURRENCIES = void 0;
4
4
  exports.CURRENCIES = {
5
5
  AED: { symbol: "د.إ" },
6
6
  AFN: { symbol: "؋" },
7
+ ALL: { symbol: "" },
7
8
  AMD: { symbol: "֏" },
8
9
  ANG: { symbol: "ƒ" },
10
+ AOA: { symbol: "" },
9
11
  ARS: { symbol: "$" },
10
12
  AUD: { symbol: "$" },
11
13
  AWG: { symbol: "ƒ" },
12
14
  AZN: { symbol: "₼" },
15
+ BAM: { symbol: "" },
16
+ BBD: { symbol: "" },
13
17
  BDT: { symbol: "৳" },
14
18
  BGN: { symbol: "лв" },
15
19
  BHD: { symbol: ".د.ب" },
16
20
  BIF: { symbol: "FBu" },
21
+ BMD: { symbol: "" },
22
+ BND: { symbol: "" },
23
+ BOB: { symbol: "" },
24
+ BOV: { symbol: "" },
17
25
  BRL: { symbol: "R$" },
26
+ BSD: { symbol: "" },
18
27
  BTN: { symbol: "Nu." },
28
+ BWP: { symbol: "" },
19
29
  BYN: { symbol: "Br" },
30
+ BZD: { symbol: "" },
20
31
  CAD: { symbol: "$" },
32
+ CDF: { symbol: "" },
33
+ CHE: { symbol: "" },
21
34
  CHF: { symbol: "CHF" },
35
+ CHW: { symbol: "" },
36
+ CLF: { symbol: "" },
22
37
  CLP: { symbol: "$" },
23
38
  CNY: { symbol: "¥" },
24
39
  COP: { symbol: "$" },
40
+ COU: { symbol: "" },
25
41
  CRC: { symbol: "₡" },
42
+ CUC: { symbol: "" },
26
43
  CUP: { symbol: "₱" },
27
44
  CVE: { symbol: "$" },
28
45
  CZK: { symbol: "Kč" },
29
46
  DJF: { symbol: "Fdj" },
30
47
  DKK: { symbol: "kr" },
48
+ DOP: { symbol: "" },
49
+ DZD: { symbol: "" },
31
50
  EGP: { symbol: "£" },
32
51
  ERN: { symbol: "Nfk" },
52
+ ETB: { symbol: "" },
33
53
  EUR: { symbol: "€" },
34
54
  FJD: { symbol: "$" },
55
+ FKP: { symbol: "" },
35
56
  GBP: { symbol: "£" },
36
57
  GEL: { symbol: "₾" },
58
+ GHS: { symbol: "" },
59
+ GIP: { symbol: "" },
37
60
  GMD: { symbol: "D" },
38
61
  GNF: { symbol: "FG" },
62
+ GTQ: { symbol: "" },
63
+ GYD: { symbol: "" },
39
64
  HKD: { symbol: "$" },
40
- HRK: { symbol: "kn" },
65
+ HNL: { symbol: "" },
41
66
  HTG: { symbol: "G" },
42
67
  HUF: { symbol: "Ft" },
43
68
  IDR: { symbol: "Rp" },
69
+ ILS: { symbol: "" },
44
70
  INR: { symbol: "₹" },
45
71
  IQD: { symbol: "ع.د" },
72
+ IRR: { symbol: "" },
46
73
  ISK: { symbol: "kr" },
74
+ JMD: { symbol: "" },
75
+ JOD: { symbol: "" },
47
76
  JPY: { symbol: "¥" },
77
+ KES: { symbol: "" },
48
78
  KGS: { symbol: "с" },
49
79
  KHR: { symbol: "៛" },
50
80
  KMF: { symbol: "CF" },
81
+ KPW: { symbol: "" },
51
82
  KRW: { symbol: "₩" },
52
83
  KWD: { symbol: "د.ك" },
84
+ KYD: { symbol: "" },
53
85
  KZT: { symbol: "₸" },
86
+ LAK: { symbol: "" },
87
+ LBP: { symbol: "" },
54
88
  LKR: { symbol: "₨" },
55
89
  LRD: { symbol: "$" },
56
90
  LSL: { symbol: "L" },
91
+ LYD: { symbol: "" },
92
+ MAD: { symbol: "" },
57
93
  MDL: { symbol: "L" },
94
+ MGA: { symbol: "" },
95
+ MKD: { symbol: "" },
58
96
  MMK: { symbol: "K" },
59
97
  MNT: { symbol: "₮" },
60
- MRO: { symbol: "UM" },
98
+ MOP: { symbol: "" },
99
+ MRU: { symbol: "" },
100
+ MUR: { symbol: "" },
101
+ MVR: { symbol: "" },
61
102
  MWK: { symbol: "MK" },
62
103
  MXN: { symbol: "$" },
104
+ MXV: { symbol: "" },
63
105
  MYR: { symbol: "RM" },
64
106
  MZN: { symbol: "MT" },
107
+ NAD: { symbol: "" },
65
108
  NGN: { symbol: "₦" },
109
+ NIO: { symbol: "" },
66
110
  NOK: { symbol: "kr" },
67
111
  NPR: { symbol: "₨" },
68
112
  NZD: { symbol: "$" },
113
+ OMR: { symbol: "" },
114
+ PAB: { symbol: "" },
69
115
  PEN: { symbol: "S/" },
70
116
  PGK: { symbol: "K" },
71
117
  PHP: { symbol: "₱" },
72
118
  PKR: { symbol: "₨" },
73
119
  PLN: { symbol: "zł" },
74
120
  PYG: { symbol: "₲" },
121
+ QAR: { symbol: "" },
75
122
  RON: { symbol: "lei" },
76
123
  RSD: { symbol: "дин." },
77
124
  RUB: { symbol: "₽" },
125
+ RWF: { symbol: "" },
126
+ SAR: { symbol: "" },
78
127
  SBD: { symbol: "$" },
128
+ SCR: { symbol: "" },
79
129
  SDG: { symbol: "ج.س." },
80
130
  SEK: { symbol: "kr" },
81
131
  SGD: { symbol: "$" },
132
+ SHP: { symbol: "" },
133
+ SLE: { symbol: "" },
82
134
  SLL: { symbol: "Le" },
135
+ SOS: { symbol: "" },
83
136
  SRD: { symbol: "$" },
137
+ SSP: { symbol: "" },
138
+ STN: { symbol: "" },
139
+ SVC: { symbol: "" },
84
140
  SYP: { symbol: "£" },
85
141
  SZL: { symbol: "E" },
86
142
  THB: { symbol: "฿" },
87
143
  TJS: { symbol: "ЅМ" },
88
144
  TMT: { symbol: "m" },
145
+ TND: { symbol: "" },
146
+ TOP: { symbol: "" },
89
147
  TRY: { symbol: "₺" },
148
+ TTD: { symbol: "" },
149
+ TWD: { symbol: "" },
90
150
  TZS: { symbol: "Sh" },
151
+ UAH: { symbol: "" },
91
152
  UGX: { symbol: "USh" },
92
153
  USD: { symbol: "$" },
154
+ USN: { symbol: "" },
155
+ UYI: { symbol: "" },
93
156
  UYU: { symbol: "$" },
157
+ UYW: { symbol: "" },
94
158
  UZS: { symbol: "soʻm" },
159
+ VED: { symbol: "" },
95
160
  VES: { symbol: "Bs" },
96
161
  VND: { symbol: "₫" },
97
162
  VUV: { symbol: "VT" },
98
163
  WST: { symbol: "T" },
164
+ XAF: { symbol: "" },
165
+ XCD: { symbol: "" },
99
166
  XOF: { symbol: "CFA" },
100
167
  XPF: { symbol: "₣" },
101
168
  YER: { symbol: "﷼" },
102
169
  ZAR: { symbol: "R" },
103
170
  ZMW: { symbol: "ZK" },
171
+ ZWL: { symbol: "" },
104
172
  };
@@ -1,3 +1,3 @@
1
- import { LocalizeConfig } from "../types";
1
+ import { DateTimes, LocalizeConfig } from "../types";
2
2
  import currencyjs from "currency.js";
3
- export declare const _mapOptions: (options: LocalizeConfig["number"] | LocalizeConfig["currency"]) => currencyjs.Options;
3
+ export declare const _mapOptions: (options: LocalizeConfig<DateTimes>["number"] | LocalizeConfig<DateTimes>["currency"]) => currencyjs.Options;