@visulima/iso-locale 1.0.0-alpha.7 → 1.0.0-alpha.9
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/CHANGELOG.md +29 -0
- package/dist/countries.d.ts +117 -116
- package/dist/currencies.d.ts +56 -55
- package/dist/index.d.ts +19 -10
- package/dist/locale.d.ts +37 -36
- package/dist/regions.d.ts +48 -47
- package/dist/timezones.d.ts +32 -31
- package/dist/types.d.ts +53 -52
- package/package.json +31 -31
- package/dist/data/countries.d.ts +0 -2853
- package/dist/data/currencies.d.ts +0 -937
- package/dist/data/currency-symbol.d.ts +0 -7
- package/dist/data/iso-639-mapping.d.ts +0 -12
- package/dist/data/regions.d.ts +0 -7
- package/dist/data/timezones.d.ts +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
## @visulima/iso-locale [1.0.0-alpha.9](https://github.com/visulima/visulima/compare/@visulima/iso-locale@1.0.0-alpha.8...@visulima/iso-locale@1.0.0-alpha.9) (2026-05-26)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **security:** address codeql findings across packages ([3366f9c](https://github.com/visulima/visulima/commit/3366f9c07d54bdde5242fbd90780baa4634de179))
|
|
6
|
+
|
|
7
|
+
### Miscellaneous Chores
|
|
8
|
+
|
|
9
|
+
* **ci-stability:** green CI across vis, native, lint, tests, attw ([#651](https://github.com/visulima/visulima/issues/651)) ([d4eb684](https://github.com/visulima/visulima/commit/d4eb684b5f75c818c9251048c605a0ed54a268e3))
|
|
10
|
+
* **iso-locale:** housekeeping cleanup ([326d3e4](https://github.com/visulima/visulima/commit/326d3e4be152fdcb828da32a67341fae0c274709))
|
|
11
|
+
* **iso-locale:** upgrade packem to 2.0.0-alpha.76 ([9908d9c](https://github.com/visulima/visulima/commit/9908d9c57641ade481016ea711981e03d53c746c))
|
|
12
|
+
* re-sort workspace package.json files via vis sort-package-json ([f625696](https://github.com/visulima/visulima/commit/f625696cfac974325774b3243e1a83c3d23acbd7))
|
|
13
|
+
* **repo:** sort package.json keys across all packages ([e1fd9ab](https://github.com/visulima/visulima/commit/e1fd9ab467ef96a98c777da1572ff6a50fcf7e71))
|
|
14
|
+
|
|
15
|
+
### Tests
|
|
16
|
+
|
|
17
|
+
* **repo:** add dist runtime + types integration tests ([32ee300](https://github.com/visulima/visulima/commit/32ee300b7184117a0ddf9f9d390f75f8932d5ed9))
|
|
18
|
+
|
|
19
|
+
## @visulima/iso-locale [1.0.0-alpha.8](https://github.com/visulima/visulima/compare/@visulima/iso-locale@1.0.0-alpha.7...@visulima/iso-locale@1.0.0-alpha.8) (2026-04-22)
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* Remove JSR configuration generation script and generated jsr.json files ([#616](https://github.com/visulima/visulima/issues/616)) ([533744b](https://github.com/visulima/visulima/commit/533744b103b74896941db5b727173e617a27a63b))
|
|
24
|
+
|
|
25
|
+
### Miscellaneous Chores
|
|
26
|
+
|
|
27
|
+
* bump engines.node to ^22.14.0 || >=24.10.0 ([c3d0931](https://github.com/visulima/visulima/commit/c3d0931d1504e4f21ebf50ea680cfa7ce4ba15ce))
|
|
28
|
+
* fixed jsr.json ([5d85e51](https://github.com/visulima/visulima/commit/5d85e5179de38e284ec433b14d77c71a1619c8d6))
|
|
29
|
+
|
|
1
30
|
## @visulima/iso-locale [1.0.0-alpha.7](https://github.com/visulima/visulima/compare/@visulima/iso-locale@1.0.0-alpha.6...@visulima/iso-locale@1.0.0-alpha.7) (2026-04-15)
|
|
2
31
|
|
|
3
32
|
### Bug Fixes
|
package/dist/countries.d.ts
CHANGED
|
@@ -1,116 +1,117 @@
|
|
|
1
|
-
import
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
1
|
+
import { Country } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Get country by ISO 3166-1 alpha-2 code.
|
|
4
|
+
* @param code 2-letter country code (e.g., "US")
|
|
5
|
+
* @returns Country object or undefined
|
|
6
|
+
*/
|
|
7
|
+
declare const getByAlpha2: (code: string) => Country | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Get country by ISO 3166-1 alpha-3 code.
|
|
10
|
+
* @param code 3-letter country code (e.g., "USA")
|
|
11
|
+
* @returns Country object or undefined
|
|
12
|
+
*/
|
|
13
|
+
declare const getByAlpha3: (code: string) => Country | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Get country by ISO 3166-1 numeric code.
|
|
16
|
+
* @param code 3-digit numeric code (e.g., "840")
|
|
17
|
+
* @returns Country object or undefined
|
|
18
|
+
*/
|
|
19
|
+
declare const getByNumeric: (code: string | number) => Country | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Convert alpha-2 code to alpha-3 code.
|
|
22
|
+
* @param alpha2 2-letter country code
|
|
23
|
+
* @returns 3-letter country code or undefined
|
|
24
|
+
*/
|
|
25
|
+
declare const alpha2ToAlpha3: (alpha2: string) => string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Convert alpha-3 code to alpha-2 code.
|
|
28
|
+
* @param alpha3 3-letter country code
|
|
29
|
+
* @returns 2-letter country code or undefined
|
|
30
|
+
*/
|
|
31
|
+
declare const alpha3ToAlpha2: (alpha3: string) => string | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Convert alpha-2 code to numeric code.
|
|
34
|
+
* @param alpha2 2-letter country code
|
|
35
|
+
* @returns 3-digit numeric code or undefined
|
|
36
|
+
*/
|
|
37
|
+
declare const alpha2ToNumeric: (alpha2: string) => string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Convert alpha-3 code to numeric code.
|
|
40
|
+
* @param alpha3 3-letter country code
|
|
41
|
+
* @returns 3-digit numeric code or undefined
|
|
42
|
+
*/
|
|
43
|
+
declare const alpha3ToNumeric: (alpha3: string) => string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Convert numeric code to alpha-2 code.
|
|
46
|
+
* @param numeric 3-digit numeric code
|
|
47
|
+
* @returns 2-letter country code or undefined
|
|
48
|
+
*/
|
|
49
|
+
declare const numericToAlpha2: (numeric: string | number) => string | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Convert numeric code to alpha-3 code.
|
|
52
|
+
* @param numeric 3-digit numeric code
|
|
53
|
+
* @returns 3-letter country code or undefined
|
|
54
|
+
*/
|
|
55
|
+
declare const numericToAlpha3: (numeric: string | number) => string | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Check if a country code is valid (supports alpha-2, alpha-3, or numeric).
|
|
58
|
+
* @param code Country code in any format
|
|
59
|
+
* @returns true if valid, false otherwise
|
|
60
|
+
*/
|
|
61
|
+
declare const isValid: (code: string | number) => boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Countries indexed by alpha-2 code.
|
|
64
|
+
*/
|
|
65
|
+
declare const byAlpha2: Readonly<Record<string, Country>>;
|
|
66
|
+
/**
|
|
67
|
+
* Countries indexed by alpha-3 code.
|
|
68
|
+
*/
|
|
69
|
+
declare const byAlpha3: Readonly<Record<string, Country>>;
|
|
70
|
+
/**
|
|
71
|
+
* Countries indexed by numeric code.
|
|
72
|
+
*/
|
|
73
|
+
declare const byNumeric: Readonly<Record<string, Country>>;
|
|
74
|
+
/**
|
|
75
|
+
* Get flag emoji for a country.
|
|
76
|
+
* @param countryCode ISO 3166-1 alpha-2, alpha-3, or numeric code
|
|
77
|
+
* @returns Flag emoji or undefined
|
|
78
|
+
*/
|
|
79
|
+
declare const getEmoji: (countryCode: string | number) => string | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Get country calling code (phone prefix) for a country.
|
|
82
|
+
* @param countryCode ISO 3166-1 alpha-2, alpha-3, or numeric code
|
|
83
|
+
* @returns First calling code or undefined
|
|
84
|
+
*/
|
|
85
|
+
declare const getCallingCode: (countryCode: string | number) => string | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* Get all calling codes for a country.
|
|
88
|
+
* @param countryCode ISO 3166-1 alpha-2, alpha-3, or numeric code
|
|
89
|
+
* @returns Array of calling codes or empty array
|
|
90
|
+
*/
|
|
91
|
+
declare const getCallingCodes: (countryCode: string | number) => string[];
|
|
92
|
+
/**
|
|
93
|
+
* Get languages for a country.
|
|
94
|
+
* @param countryCode ISO 3166-1 alpha-2, alpha-3, or numeric code
|
|
95
|
+
* @returns Array of ISO 639 language codes or empty array
|
|
96
|
+
*/
|
|
97
|
+
declare const getLanguages: (countryCode: string | number) => string[];
|
|
98
|
+
/**
|
|
99
|
+
* Get International Olympic Committee code for a country.
|
|
100
|
+
* @param countryCode ISO 3166-1 alpha-2, alpha-3, or numeric code
|
|
101
|
+
* @returns IOC code or undefined
|
|
102
|
+
*/
|
|
103
|
+
declare const getIOC: (countryCode: string | number) => string | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Get country by name (exact match, case-insensitive).
|
|
106
|
+
* @param name Country name (e.g., "United States")
|
|
107
|
+
* @returns Country object or undefined
|
|
108
|
+
*/
|
|
109
|
+
declare const getCountryByName: (name: string) => Country | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* Search countries by name (partial match, case-insensitive).
|
|
112
|
+
* @param query Search query (e.g., "united")
|
|
113
|
+
* @returns Array of matching Country objects
|
|
114
|
+
*/
|
|
115
|
+
declare const searchCountries: (query: string) => Country[];
|
|
116
|
+
declare const all: Country[];
|
|
117
|
+
export { all, alpha2ToAlpha3, alpha2ToNumeric, alpha3ToAlpha2, alpha3ToNumeric, byAlpha2, byAlpha3, byNumeric, getByAlpha2, getByAlpha3, getByNumeric, getCallingCode, getCallingCodes, getCountryByName, getEmoji, getIOC, getLanguages, isValid, numericToAlpha2, numericToAlpha3, searchCountries };
|
package/dist/currencies.d.ts
CHANGED
|
@@ -1,67 +1,68 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Currency } from "./types.js";
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
* All currencies array
|
|
4
|
+
*/
|
|
5
|
+
declare const all: ReadonlyArray<Currency>;
|
|
6
6
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
* Get currency by ISO 4217 alphabetic code.
|
|
8
|
+
* @param code 3-letter currency code (e.g., "USD")
|
|
9
|
+
* @returns Currency object or undefined
|
|
10
|
+
*/
|
|
11
|
+
declare const getByCode: (code: string) => Currency | undefined;
|
|
12
12
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
* Get currency by ISO 4217 numeric code.
|
|
14
|
+
* @param number 3-digit numeric code (e.g., "840")
|
|
15
|
+
* @returns Currency object or undefined
|
|
16
|
+
*/
|
|
17
|
+
declare const getByNumber: (number: string | number) => Currency | undefined;
|
|
18
18
|
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
* Get currencies used by a country (by alpha-2 code).
|
|
20
|
+
* @param countryCode ISO 3166-1 alpha-2 country code (e.g., "US")
|
|
21
|
+
* @returns Array of Currency objects
|
|
22
|
+
*/
|
|
23
|
+
declare const getByCountry: (countryCode: string) => Currency[];
|
|
24
24
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
* Get all countries using a specific currency.
|
|
26
|
+
* @param currencyCode ISO 4217 currency code (e.g., "USD")
|
|
27
|
+
* @returns Array of country alpha-2 codes
|
|
28
|
+
*/
|
|
29
|
+
declare const getCountriesByCurrency: (currencyCode: string) => string[];
|
|
30
30
|
/**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
* Get currency symbol for a currency code.
|
|
32
|
+
* @param currencyCode ISO 4217 currency code
|
|
33
|
+
* @returns Currency symbol or the code itself if symbol not found
|
|
34
|
+
*/
|
|
35
|
+
declare const getSymbol: (currencyCode: string) => string;
|
|
36
36
|
/**
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
* Get currency name for a currency code.
|
|
38
|
+
* @param currencyCode ISO 4217 currency code
|
|
39
|
+
* @returns Currency name or undefined
|
|
40
|
+
*/
|
|
41
|
+
declare const getName: (currencyCode: string) => string | undefined;
|
|
42
42
|
/**
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
* Check if a currency code is valid.
|
|
44
|
+
* @param code Currency code (alphabetic or numeric)
|
|
45
|
+
* @returns true if valid, false otherwise
|
|
46
|
+
*/
|
|
47
|
+
declare const isValid: (code: string | number) => boolean;
|
|
48
48
|
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
* Currencies indexed by code
|
|
50
|
+
*/
|
|
51
|
+
declare const byCode: Readonly<Record<string, Currency>>;
|
|
52
52
|
/**
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
* Currencies indexed by numeric code
|
|
54
|
+
*/
|
|
55
|
+
declare const byNumber: Readonly<Record<string, Currency>>;
|
|
56
56
|
/**
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
* Get currency by name (exact match, case-insensitive).
|
|
58
|
+
* @param name Currency name (e.g., "US Dollar")
|
|
59
|
+
* @returns Currency object or undefined
|
|
60
|
+
*/
|
|
61
|
+
declare const getCurrencyByName: (name: string) => Currency | undefined;
|
|
62
62
|
/**
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
* Search currencies by name (partial match, case-insensitive).
|
|
64
|
+
* @param query Search query (e.g., "dollar")
|
|
65
|
+
* @returns Array of matching Currency objects
|
|
66
|
+
*/
|
|
67
|
+
declare const searchCurrencies: (query: string) => Currency[];
|
|
68
|
+
export { all, byCode, byNumber, getByCode, getByCountry, getByNumber, getCountriesByCurrency, getCurrencyByName, getName, getSymbol, isValid, searchCurrencies };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
export { alpha2ToAlpha3, alpha2ToNumeric, alpha3ToAlpha2, alpha3ToNumeric, byAlpha2, byAlpha3, byNumeric, all as countriesAll, getByAlpha2, getByAlpha3, getByNumeric, getCallingCode, getCallingCodes, getCountryByName, getEmoji, getIOC, getLanguages, isValid as isValidCountry, numericToAlpha2, numericToAlpha3, searchCountries
|
|
2
|
-
export { all as
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export { all as
|
|
6
|
-
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
export { alpha2ToAlpha3, alpha2ToNumeric, alpha3ToAlpha2, alpha3ToNumeric, byAlpha2, byAlpha3, byNumeric, all as countries, all as countriesAll, getByAlpha2, getByAlpha3, getByNumeric, getCallingCode, getCallingCodes, getCountryByName, getEmoji, getIOC, getLanguages, isValid, isValid as isValidCountry, numericToAlpha2, numericToAlpha3, searchCountries } from "./countries.js";
|
|
2
|
+
export { byCode, byNumber, all as currencies, all as currenciesAll, getByCode, getByCountry, getByNumber, getCountriesByCurrency, getCurrencyByName, getName, getSymbol, isValid as isValidCurrency, searchCurrencies } from "./currencies.js";
|
|
3
|
+
export { generateBCP47Tag, getBCP47Tags, getCurrency, getLocales, isValidBCP47Tag, parseBCP47Tag } from "./locale.js";
|
|
4
|
+
export { getContinents, getCountriesInContinent, getCountriesInIntermediary, getCountriesInSubregion, getIntermediaryRegions, getRegionsForCountry, getSubregions, all as regions } from "./regions.js";
|
|
5
|
+
export { getCountriesForTimezone, getCountriesWithTimezones, getPrimaryTimezone, getTimezonesByCountry, isValidTimezone, all as timezonesAll, byCountry as timezonesByCountry } from "./timezones.js";
|
|
6
|
+
export { type Country, type Currency, type CurrencySymbolEntry, type Region } from "./types.js";
|
|
7
|
+
/**
|
|
8
|
+
* Converts ISO 639-3 (3-letter) code to ISO 639-1 (2-letter) code.
|
|
9
|
+
* @param iso6393 ISO 639-3 language code (e.g., "eng")
|
|
10
|
+
* @returns ISO 639-1 code (e.g., "en") or undefined if not found
|
|
11
|
+
*/
|
|
12
|
+
declare const iso6393To6391: (iso6393: string) => string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Gets all ISO 639-1 codes from ISO 639-3 codes.
|
|
15
|
+
* @param iso6393Codes Array of ISO 639-3 codes
|
|
16
|
+
* @returns Array of ISO 639-1 codes (filtered to only valid mappings)
|
|
17
|
+
*/
|
|
18
|
+
declare const convert6393To6391: (iso6393Codes: string[]) => string[];
|
|
19
|
+
export { convert6393To6391, iso6393To6391 };
|
package/dist/locale.d.ts
CHANGED
|
@@ -1,43 +1,44 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
* Get currency code from locale or country code.
|
|
3
|
+
* Supports BCP 47 tags (en-US), underscore format (en_US), or ISO 3166-1 alpha-2 (US).
|
|
4
|
+
* @param locale Locale string or country code
|
|
5
|
+
* @returns ISO 4217 currency code or undefined
|
|
6
|
+
*/
|
|
7
|
+
declare const getCurrency: (locale: string) => string | undefined;
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
* Get all country codes (alpha-2) that use a specific currency.
|
|
10
|
+
* @param currencyCode ISO 4217 currency code (e.g., "EUR")
|
|
11
|
+
* @returns Array of ISO 3166-1 alpha-2 country codes
|
|
12
|
+
*/
|
|
13
|
+
declare const getLocales: (currencyCode: string) => string[];
|
|
14
14
|
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
* Parse a BCP 47 language tag into its components.
|
|
16
|
+
* @param tag BCP 47 language tag (e.g., "en-US", "zh-Hant-TW")
|
|
17
|
+
* @returns Parsed components or undefined if invalid
|
|
18
|
+
*/
|
|
19
|
+
declare const parseBCP47Tag: (tag: string) => {
|
|
20
|
+
country?: string;
|
|
21
|
+
language: string;
|
|
22
|
+
script?: string;
|
|
23
23
|
} | undefined;
|
|
24
24
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
* Generate a BCP 47 language tag from language and country codes.
|
|
26
|
+
* @param languageCode ISO 639-1 language code (e.g., "en")
|
|
27
|
+
* @param countryCode ISO 3166-1 alpha-2 country code (e.g., "US")
|
|
28
|
+
* @param script Optional script code (e.g., "Latn", "Hant")
|
|
29
|
+
* @returns BCP 47 tag (e.g., "en-US", "zh-Hant-TW")
|
|
30
|
+
*/
|
|
31
|
+
declare const generateBCP47Tag: (languageCode: string, countryCode: string, script?: string) => string;
|
|
32
32
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
* Get all BCP 47 language tags for a country.
|
|
34
|
+
* @param countryCode ISO 3166-1 alpha-2 country code (e.g., "US")
|
|
35
|
+
* @returns Array of BCP 47 tags (e.g., ["en-US"])
|
|
36
|
+
*/
|
|
37
|
+
declare const getBCP47Tags: (countryCode: string) => string[];
|
|
38
38
|
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
* Validate a BCP 47 language tag format.
|
|
40
|
+
* @param tag BCP 47 language tag to validate
|
|
41
|
+
* @returns true if format is valid, false otherwise
|
|
42
|
+
*/
|
|
43
|
+
declare const isValidBCP47Tag: (tag: string) => boolean;
|
|
44
|
+
export { generateBCP47Tag, getBCP47Tags, getCurrency, getLocales, isValidBCP47Tag, parseBCP47Tag };
|
package/dist/regions.d.ts
CHANGED
|
@@ -1,47 +1,48 @@
|
|
|
1
|
-
import
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
1
|
+
import { Region } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Get region information for a country.
|
|
4
|
+
* @param countryCode ISO 3166-1 alpha-2 country code (e.g., "US")
|
|
5
|
+
* @returns Region object or undefined
|
|
6
|
+
*/
|
|
7
|
+
declare const getRegionsForCountry: (countryCode: string) => Region | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Get all countries in a continental region.
|
|
10
|
+
* @param continent Continental region (e.g., "Africa", "Americas", "Asia", "Europe", "Oceania", "Antarctica")
|
|
11
|
+
* @returns Array of ISO 3166-1 alpha-2 country codes
|
|
12
|
+
*/
|
|
13
|
+
declare const getCountriesInContinent: (continent: string) => string[];
|
|
14
|
+
/**
|
|
15
|
+
* Get all countries in a geographical subregion.
|
|
16
|
+
* @param subregion Geographical subregion (e.g., "Northern Africa", "Western Europe")
|
|
17
|
+
* @returns Array of ISO 3166-1 alpha-2 country codes
|
|
18
|
+
*/
|
|
19
|
+
declare const getCountriesInSubregion: (subregion: string) => string[];
|
|
20
|
+
/**
|
|
21
|
+
* Get all countries in an intermediary region.
|
|
22
|
+
* @param intermediary Intermediary region (e.g., "Sub-Saharan Africa", "Latin America and the Caribbean")
|
|
23
|
+
* @returns Array of ISO 3166-1 alpha-2 country codes
|
|
24
|
+
*/
|
|
25
|
+
declare const getCountriesInIntermediary: (intermediary: string) => string[];
|
|
26
|
+
/**
|
|
27
|
+
* Get all available continental regions.
|
|
28
|
+
* @returns Array of continental region names
|
|
29
|
+
*/
|
|
30
|
+
declare const getContinents: () => string[];
|
|
31
|
+
/**
|
|
32
|
+
* Get all available geographical subregions.
|
|
33
|
+
* @param continent Optional filter by continent
|
|
34
|
+
* @returns Array of subregion names
|
|
35
|
+
*/
|
|
36
|
+
declare const getSubregions: (continent?: string) => string[];
|
|
37
|
+
/**
|
|
38
|
+
* Get all available intermediary regions.
|
|
39
|
+
* @param continent Optional filter by continent
|
|
40
|
+
* @returns Array of intermediary region names
|
|
41
|
+
*/
|
|
42
|
+
declare const getIntermediaryRegions: (continent?: string) => string[];
|
|
43
|
+
/**
|
|
44
|
+
* Get all regions data
|
|
45
|
+
* @returns Record of country codes to regions
|
|
46
|
+
*/
|
|
47
|
+
declare const all: Readonly<Record<string, Region>>;
|
|
48
|
+
export { all, getContinents, getCountriesInContinent, getCountriesInIntermediary, getCountriesInSubregion, getIntermediaryRegions, getRegionsForCountry, getSubregions };
|