country-codes-list 1.6.11 → 1.6.12

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.
Files changed (3) hide show
  1. package/README.md +14 -8
  2. package/index.d.ts +16 -29
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # country-codes-list
2
+
2
3
  Module with list of codes per country, which includes:
3
4
 
4
5
  - Country code (ISO 3166-1 alpha-2): Obtained from [Wikipedia](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
@@ -9,12 +10,13 @@ Module with list of codes per country, which includes:
9
10
  - TIN Name: Obtained from [Wikipedia](https://en.wikipedia.org/wiki/VAT_identification_number)
10
11
  - Official language code (usually from ISO 639-1, or ISO 639-3 otherwise)): Obtained from [Open Street Map](https://wiki.openstreetmap.org/wiki/Nominatim/Country_Codes). Returns only the first official language code per country
11
12
  - Official language name: Each name in english and in the local country language
12
- - Country Calling Code: The phone calling code for the country. Obtained from [Wikipedia](https://en.wikipedia.org/wiki/List_of_country_calling_codes#Alphabetical_listing_by_country_or_region).
13
+ - Country Calling Code: The phone calling code for the country. Obtained from [Wikipedia](https://en.wikipedia.org/wiki/List_of_country_calling_codes#Alphabetical_listing_by_country_or_region).
13
14
  - Region: The Regional Classifications are from the [International Telecommunications Union](http://www.itu.int/ITU-D/ict/definitions/regions/index.html). Seen [here](https://meta.wikimedia.org/wiki/List_of_countries_by_regional_classification)
14
15
 
15
-
16
16
  # Installation
17
+
17
18
  ## Install the NPM module
19
+
18
20
  ```bash
19
21
  npm install --save country-codes-list
20
22
  ```
@@ -23,9 +25,10 @@ Module with list of codes per country, which includes:
23
25
 
24
26
  ### customList method:
25
27
 
26
- Just import the module and call the customList method. The first parameter must be the key you want for your object, and the second parameter must be a string with placeholders written as you need. The placeholders are defined between brackets (`{placeholder}`).
28
+ Just import the module and call the customList method. The first parameter must be the key you want for your object, and the second parameter must be a string with placeholders written as you need. The placeholders are defined between brackets (`{placeholder}`).
29
+
30
+ The possible values for the object key and the placeholders are:
27
31
 
28
- The possible values for the object key and the placeholders are:
29
32
  - countryNameEn
30
33
  - countryNameLocal
31
34
  - countryCode
@@ -43,12 +46,15 @@ The possible values for the object key and the placeholders are:
43
46
  #### Example
44
47
 
45
48
  ```js
46
- const countryCodes = require('country-codes-list')
49
+ const countryCodes = require("country-codes-list");
47
50
 
48
- const myCountryCodesObject = countryCodes.customList('countryCode', '[{countryCode}] {countryNameEn}: +{countryCallingCode}')
51
+ const myCountryCodesObject = countryCodes.customList(
52
+ "countryCode",
53
+ "[{countryCode}] {countryNameEn}: +{countryCallingCode}"
54
+ );
49
55
  ```
50
56
 
51
- This will return an object like this one:
57
+ This will return an object like this one:
52
58
 
53
59
  ```js
54
60
  {
@@ -69,4 +75,4 @@ This will return an object like this one:
69
75
  ...
70
76
  }
71
77
 
72
- ```
78
+ ```
package/index.d.ts CHANGED
@@ -2,38 +2,25 @@
2
2
  // by jakeisnt, Feb. 2022
3
3
 
4
4
  declare module 'country-codes-list' {
5
- export enum CountryProperty {
6
- countryNameEn = 'countryNameEn',
7
- countryNameLocal = 'countryNameLocal',
8
- countryCode = 'countryCode',
9
- currencyCode = 'currencyCode',
10
- currencyNameEn = 'currencyNameEn',
11
- tinType = 'tinType',
12
- tinName = 'tinName',
13
- officialLanguageCode = 'officialLanguageCode',
14
- officialLanguageNameEn = 'officialLanguageNameEn',
15
- officialLanguageNameLocal = 'officialLanguageNameLocal',
16
- countryCallingCode = 'countryCallingCode',
17
- region = 'region',
18
- flag = 'flag',
19
- }
20
5
 
21
- type CountryData = {
22
- [CountryProperty.countryNameEn]: string
23
- [CountryProperty.countryNameLocal]: string
24
- [CountryProperty.countryCode]: string
25
- [CountryProperty.currencyCode]: string
26
- [CountryProperty.currencyNameEn]: string
27
- [CountryProperty.tinType]: string
28
- [CountryProperty.tinName]: string
29
- [CountryProperty.officialLanguageCode]: string
30
- [CountryProperty.officialLanguageNameEn]: string
31
- [CountryProperty.officialLanguageNameLocal]: string
32
- [CountryProperty.countryCallingCode]: string
33
- [CountryProperty.region]: string
34
- [CountryProperty.flag]: string
6
+ export type CountryData = {
7
+ countryNameEn: string
8
+ countryNameLocal: string
9
+ countryCode: string
10
+ currencyCode: string
11
+ currencyNameEn: string
12
+ tinType: string
13
+ tinName: string
14
+ officialLanguageCode: string
15
+ officialLanguageNameEn: string
16
+ officialLanguageNameLocal: string
17
+ countryCallingCode: string
18
+ region: string
19
+ flag: string
35
20
  }
36
21
 
22
+ export type CountryProperty = keyof CountryData
23
+
37
24
  type Filter<T> = (element: T, index: number, array: T[]) => T[]
38
25
 
39
26
  type CustomArraySettings = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "country-codes-list",
3
- "version": "1.6.11",
3
+ "version": "1.6.12",
4
4
  "description": "List of codes per country (languages, calling codes, currency codes, etc)",
5
5
  "main": "index.js",
6
6
  "types": "./index.d.ts",
@@ -34,4 +34,4 @@
34
34
  "url": "https://github.com/LucianoGanga/country-codes/issues"
35
35
  },
36
36
  "homepage": "https://github.com/LucianoGanga/country-codes#readme"
37
- }
37
+ }