country-data-filter 1.0.16 → 1.0.17

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,82 +14,129 @@ In your JavaScript or TypeScript project, you can import the functions provided
14
14
  JavaScript
15
15
  javascript
16
16
  Copy code
17
- const {
18
- getProvincesDistrictsCitiesByCountryFunction,
19
- getCountryProvinceCityByDistrict,
20
- getCountryDistrictsCitiesByProvince,
21
- listFunctions
22
- } = require('country-data-filter');
17
+
18
+ ````js
19
+ const {
20
+ getDataByCountry,
21
+ getDataByProvince,
22
+ getDataByDistrict,
23
+ getDataByCity,
24
+ getDataByCountryProvince,
25
+ getDataByCountryProvinceDistrict,
26
+ getDataByCountryProvinceDistrictCity,
27
+ getDataByEtherCountryProvinceDistrictCity,
28
+ getDataByCountryDistrict,
29
+ getDataByCountryCity,
30
+ getDataByProvinceDistrict,
31
+ getDataByProvinceCity,
32
+ getDataByDistrictCity,
33
+ getCurrencyByCountry,
34
+ getDataByPostalCode,
35
+ listFunctions,
36
+ } = require('country-data-filter');```
37
+
23
38
  TypeScript
24
39
  typescript
25
40
  Copy code
26
- import {
27
- getProvincesDistrictsCitiesByCountryFunction,
28
- getCountryProvinceCityByDistrict,
29
- getCountryDistrictsCitiesByProvince,
30
- listFunctions
31
- } from 'country-data-filter';
32
- Functions
33
- getProvincesDistrictsCitiesByCountryFunction(code)
41
+ `import {
42
+ getDataByCountry,
43
+ getDataByProvince,
44
+ getDataByDistrict,
45
+ getDataByCity,
46
+ getDataByCountryProvince,
47
+ getDataByCountryProvinceDistrict,
48
+ getDataByCountryProvinceDistrictCity,
49
+ getDataByEtherCountryProvinceDistrictCity,
50
+ getDataByCountryDistrict,
51
+ getDataByCountryCity,
52
+ getDataByProvinceDistrict,
53
+ getDataByProvinceCity,
54
+ getDataByDistrictCity,
55
+ getCurrencyByCountry,
56
+ getDataByPostalCode,
57
+ listFunctions,
58
+ } from 'country-data-filter';`
59
+
60
+ javascript
61
+ Copy code
62
+ `const result = getDataByCountry(countryCode);
63
+ console.log(result);`
34
64
  Returns a list of provinces, districts, and cities for a given country code.
35
65
 
36
66
  Parameters:
37
-
38
67
  code (string): The country code (e.g., 'LK' for Sri Lanka).
39
- Returns:
40
68
 
69
+ Returns:
41
70
  An object containing sorted arrays of provinces, districts, and cities, or an error message if the country code is invalid.
42
- Example:
43
71
 
44
72
  javascript
45
73
  Copy code
46
- const result = getProvincesDistrictsCitiesByCountryFunction('LK');
47
- console.log(result);
48
- getCountryProvinceCityByDistrict(districtName)
74
+ `const result = getDataByDistrict(districtName);
75
+ console.log(result);`
49
76
  Returns the country code, province, and cities for a given district name.
50
77
 
51
78
  Parameters:
52
-
53
79
  districtName (string): The name of the district.
54
- Returns:
55
80
 
81
+ Returns:
56
82
  An object containing the country code, province name, and list of cities, or an error message if the district name is invalid.
57
- Example:
58
83
 
59
84
  javascript
60
85
  Copy code
61
- const result = getCountryProvinceCityByDistrict('Matara');
62
- console.log(result);
63
- getCountryDistrictsCitiesByProvince(provinceName)
86
+ `const result = getDataByProvince(provinceName);
87
+ console.log(result);`
64
88
  Returns the list of districts and cities for a given province name.
65
89
 
66
90
  Parameters:
67
-
68
91
  provinceName (string): The name of the province.
69
- Returns:
70
92
 
93
+ Returns:
71
94
  An object containing the list of districts and cities, or an error message if the province name is invalid.
72
- Example:
73
95
 
74
96
  javascript
75
97
  Copy code
76
- const result = getCountryDistrictsCitiesByProvince('Southern');
77
- console.log(result);
78
- listFunctions()
98
+ `const result = listFunctions()
99
+ console.log(result)`
79
100
  Returns a list of all available functions in the package.
80
101
 
81
102
  Returns:
82
-
83
- An object containing the function names and their references.
84
- Example:
103
+ An object containing the filtered data list.
85
104
 
86
105
  javascript
87
106
  Copy code
88
- const functions = listFunctions();
89
- console.log(functions);
107
+ `const result = getDataByEtherCountryProvinceDistrictCity();
108
+ console.log(result);`
109
+
110
+ Parameters:
111
+ countryCode (string)?: The code of the country.
112
+ provinceName (string)?: The name of the province.
113
+ districtName (string)?: The name of the district.
114
+ cityName (string)?: The name of the city.
115
+
90
116
  Data Structure
91
117
  The data for countries, provinces, districts, and cities is stored in JavaScript objects. Each country object contains provinces, and each province object contains districts and cities.
92
118
 
119
+ list of functions
120
+
121
+ javascript
122
+ Copy code
123
+ ` getDataByCountry(countryCode); // countryCode: string
124
+ getDataByProvince(provinceName); // provinceName: string
125
+ getDataByDistrict(districtName); // districtName: string
126
+ getDataByCity(cityName); // cityName: string
127
+ getDataByCountryProvince(countryCode, provinceName); // countryCode: string, provinceName: string
128
+ getDataByCountryProvinceDistrict(countryCode, provinceName, districtName); // countryCode: string, provinceName: string, districtName: string
129
+ getDataByCountryProvinceDistrictCity(countryCode, provinceName, districtName, cityName); // countryCode: string, provinceName: string, districtName: string, cityName: string
130
+ getDataByEtherCountryProvinceDistrictCity(countryCode, provinceName, districtName, cityName); // countryCode: string, provinceName: string, districtName: string, cityName: string
131
+ getDataByCountryDistrict(countryCode, districtName); // countryCode: string, districtName: string
132
+ getDataByCountryCity(countryCode, cityName); // countryCode: string, cityName: string
133
+ getDataByProvinceDistrict(provinceName, districtName); // provinceName: string districtName: string
134
+ getDataByProvinceCity(provinceName, cityName); // provinceName: string, cityName: string
135
+ getDataByDistrictCity(districtName, cityName); // districtName: string, cityName: string
136
+ getCurrencyByCountry(countryCode); // countryCode: string
137
+ getDataByPostalCode(postalCode); // postalCode: string
138
+ `
139
+
93
140
  Contributing
94
141
  If you want to contribute to this project, please follow these steps:
95
142
 
@@ -103,3 +150,4 @@ This project is licensed under the MIT License. See the LICENSE file for details
103
150
  Contact
104
151
  For any questions or support, please contact knnadeera1@gmail.com.
105
152
 
153
+ ````
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "country-data-filter",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "A package to filter country data",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -27,6 +27,7 @@ import { vavuniya } from "./districts/vavuniya";
27
27
  export const LK = {
28
28
  name: "Sri Lanka",
29
29
  code: "LK",
30
+ currency: "LKR",
30
31
  countryCode: "+94",
31
32
  provinces: {
32
33
  southern: {
@@ -0,0 +1,150 @@
1
+ import { alabama } from "./district/alabama";
2
+ import { alaska } from "./district/alaska";
3
+ import { arizona } from "./district/arizona";
4
+ import { arkansas } from "./district/arkansas";
5
+ import { california } from "./district/california";
6
+ import { colorado } from "./district/colorado";
7
+ import { connecticut } from "./district/connecticut";
8
+ import { delaware } from "./district/delaware";
9
+ import { florida } from "./district/florida";
10
+
11
+ export const US = {
12
+ name: "United States of America",
13
+ code: "US",
14
+ currency: "USD",
15
+ countryCode: "+1",
16
+ provinces: {
17
+ alabama,
18
+ alaska,
19
+ arizona,
20
+ arkansas,
21
+ california,
22
+ colorado,
23
+ connecticut,
24
+ delaware,
25
+ florida,
26
+ georgia: {
27
+ name: "Georgia",
28
+ },
29
+ hawaii: {
30
+ name: "Hawaii",
31
+ },
32
+ idaho: {
33
+ name: "Idaho",
34
+ },
35
+ illinois: {
36
+ name: "Illinois",
37
+ },
38
+ indiana: {
39
+ name: "Indiana",
40
+ },
41
+ iowa: {
42
+ name: "Iowa",
43
+ },
44
+ kansas: {
45
+ name: "Kansas",
46
+ },
47
+ kentucky: {
48
+ name: "Kentucky",
49
+ },
50
+ louisiana: {
51
+ name: "Louisiana",
52
+ },
53
+ maine: {
54
+ name: "Maine",
55
+ },
56
+ maryland: {
57
+ name: "Maryland",
58
+ },
59
+ massachusetts: {
60
+ name: "Massachusetts",
61
+ },
62
+ michigan: {
63
+ name: "Michigan",
64
+ },
65
+ minnesota: {
66
+ name: "Minnesota",
67
+ },
68
+ mississippi: {
69
+ name: "Mississippi",
70
+ },
71
+ missouri: {
72
+ name: "Missouri",
73
+ },
74
+ montana: {
75
+ name: "Montana",
76
+ },
77
+ nebraska: {
78
+ name: "Nebraska",
79
+ },
80
+ nevada: {
81
+ name: "Nevada",
82
+ },
83
+ newHampshire: {
84
+ name: "New Hampshire",
85
+ },
86
+ newJersey: {
87
+ name: "New Jersey",
88
+ },
89
+ newMexico: {
90
+ name: "New Mexico",
91
+ },
92
+ newYork: {
93
+ name: "New York",
94
+ },
95
+ northCarolina: {
96
+ name: "North Carolina",
97
+ },
98
+ northDakota: {
99
+ name: "North Dakota",
100
+ },
101
+ ohio: {
102
+ name: "Ohio",
103
+ },
104
+ oklahoma: {
105
+ name: "Oklahoma",
106
+ },
107
+ oregon: {
108
+ name: "Oregon",
109
+ },
110
+ pennsylvania: {
111
+ name: "Pennsylvania",
112
+ },
113
+ rhodeIsland: {
114
+ name: "Rhode Island",
115
+ },
116
+ southCarolina: {
117
+ name: "South Carolina",
118
+ },
119
+ southDakota: {
120
+ name: "South Dakota",
121
+ },
122
+ tennessee: {
123
+ name: "Tennessee",
124
+ },
125
+ texas: {
126
+ name: "Texas",
127
+ },
128
+ utah: {
129
+ name: "Utah",
130
+ },
131
+ vermont: {
132
+ name: "Vermont",
133
+ },
134
+ virginia: {
135
+ name: "Virginia",
136
+ },
137
+ washington: {
138
+ name: "Washington",
139
+ },
140
+ westVirginia: {
141
+ name: "West Virginia",
142
+ },
143
+ wisconsin: {
144
+ name: "Wisconsin",
145
+ },
146
+ wyoming: {
147
+ name: "Wyoming",
148
+ },
149
+ },
150
+ };
@@ -0,0 +1,80 @@
1
+ export const alabama = {
2
+ name: "Alabama",
3
+ cities: [
4
+ { name: "Birmingham", postalCode: "35233" },
5
+ { name: "Montgomery", postalCode: "36104" },
6
+ { name: "Mobile", postalCode: "36602" },
7
+ { name: "Huntsville", postalCode: "35801" },
8
+ { name: "Tuscaloosa", postalCode: "35487" },
9
+ { name: "Hoover", postalCode: "35244" },
10
+ { name: "Auburn", postalCode: "36830" },
11
+ { name: "Dothan", postalCode: "36301" },
12
+ { name: "Decatur", postalCode: "35601" },
13
+ { name: "Madison", postalCode: "35758" },
14
+ { name: "Florence", postalCode: "35630" },
15
+ { name: "Gadsden", postalCode: "35901" },
16
+ { name: "Vestavia Hills", postalCode: "35216" },
17
+ { name: "Prattville", postalCode: "36066" },
18
+ { name: "Phenix City", postalCode: "36867" },
19
+ { name: "Alabaster", postalCode: "35007" },
20
+ { name: "Bessemer", postalCode: "35020" },
21
+ { name: "Enterprise", postalCode: "36330" },
22
+ { name: "Opelika", postalCode: "36801" },
23
+ { name: "Homewood", postalCode: "35209" },
24
+ { name: "Northport", postalCode: "35473" },
25
+ { name: "Anniston", postalCode: "36201" },
26
+ { name: "Prichard", postalCode: "36610" },
27
+ { name: "Athens", postalCode: "35611" },
28
+ { name: "Daphne", postalCode: "36526" },
29
+ { name: "Pelham", postalCode: "35124" },
30
+ { name: "Oxford", postalCode: "36203" },
31
+ { name: "Albertville", postalCode: "35950" },
32
+ { name: "Selma", postalCode: "36701" },
33
+ { name: "Mountain Brook", postalCode: "35223" },
34
+ { name: "Trussville", postalCode: "35173" },
35
+ { name: "Troy", postalCode: "36081" },
36
+ { name: "Center Point", postalCode: "35215" },
37
+ { name: "Foley", postalCode: "36535" },
38
+ { name: "Alexander City", postalCode: "35010" },
39
+ { name: "Gardendale", postalCode: "35071" },
40
+ { name: "Fairhope", postalCode: "36532" },
41
+ { name: "Cullman", postalCode: "35055" },
42
+ { name: "Hueytown", postalCode: "35023" },
43
+ { name: "Fort Payne", postalCode: "35967" },
44
+ { name: "Ozark", postalCode: "36360" },
45
+ { name: "Scottsboro", postalCode: "35768" },
46
+ { name: "Eufaula", postalCode: "36027" },
47
+ { name: "Chelsea", postalCode: "35043" },
48
+ { name: "Talladega", postalCode: "35160" },
49
+ { name: "Sylacauga", postalCode: "35150" },
50
+ { name: "Clanton", postalCode: "35045" },
51
+ { name: "Millbrook", postalCode: "36054" },
52
+ { name: "Hartselle", postalCode: "35640" },
53
+ { name: "Pell City", postalCode: "35125" },
54
+ { name: "Saraland", postalCode: "36571" },
55
+ { name: "Calera", postalCode: "35040" },
56
+ { name: "Muscle Shoals", postalCode: "35661" },
57
+ { name: "Jasper", postalCode: "35501" },
58
+ { name: "Fairfield", postalCode: "35064" },
59
+ { name: "Jacksonville", postalCode: "36265" },
60
+ { name: "Spanish Fort", postalCode: "36527" },
61
+ { name: "Tallassee", postalCode: "36078" },
62
+ { name: "Fultondale", postalCode: "35068" },
63
+ { name: "Heflin", postalCode: "36264" },
64
+ { name: "Irondale", postalCode: "35210" },
65
+ { name: "Satsuma", postalCode: "36572" },
66
+ { name: "Gulf Shores", postalCode: "36542" },
67
+ { name: "Oneonta", postalCode: "35121" },
68
+ { name: "Valley", postalCode: "36854" },
69
+ { name: "Odenville", postalCode: "35120" },
70
+ { name: "Clay", postalCode: "35048" },
71
+ { name: "Moody", postalCode: "35004" },
72
+ { name: "Hamilton", postalCode: "35570" },
73
+ { name: "Demopolis", postalCode: "36732" },
74
+ { name: "Grayson Valley", postalCode: "35235" },
75
+ { name: "Rainsville", postalCode: "35986" },
76
+ { name: "Childersburg", postalCode: "35044" },
77
+ { name: "Pike Road", postalCode: "36064" },
78
+ { name: "Gulf Shores", postalCode: "36542" },
79
+ ],
80
+ };
@@ -0,0 +1,25 @@
1
+ export const alaska = {
2
+ name: "alaska",
3
+ cities: [
4
+ { name: "Anchorage", postalCode: "99501" },
5
+ { name: "Fairbanks", postalCode: "99701" },
6
+ { name: "Juneau", postalCode: "99801" },
7
+ { name: "Sitka", postalCode: "99835" },
8
+ { name: "Ketchikan", postalCode: "99901" },
9
+ { name: "Wasilla", postalCode: "99654" },
10
+ { name: "Kenai", postalCode: "99611" },
11
+ { name: "Kodiak", postalCode: "99615" },
12
+ { name: "Bethel", postalCode: "99559" },
13
+ { name: "Palmer", postalCode: "99645" },
14
+ { name: "Homer", postalCode: "99603" },
15
+ { name: "Nome", postalCode: "99762" },
16
+ { name: "Valdez", postalCode: "99686" },
17
+ { name: "Barrow", postalCode: "99723" },
18
+ { name: "Soldotna", postalCode: "99669" },
19
+ { name: "Kotzebue", postalCode: "99752" },
20
+ { name: "Seward", postalCode: "99664" },
21
+ { name: "Dillingham", postalCode: "99576" },
22
+ { name: "Cordova", postalCode: "99574" },
23
+ { name: "Wrangell", postalCode: "99929" },
24
+ ],
25
+ };
@@ -0,0 +1,35 @@
1
+ export const arizona = {
2
+ name: "arizona",
3
+ cities: [
4
+ { name: "Phoenix", postalCode: "85001" },
5
+ { name: "Tucson", postalCode: "85701" },
6
+ { name: "Mesa", postalCode: "85201" },
7
+ { name: "Chandler", postalCode: "85224" },
8
+ { name: "Glendale", postalCode: "85301" },
9
+ { name: "Scottsdale", postalCode: "85250" },
10
+ { name: "Gilbert", postalCode: "85233" },
11
+ { name: "Tempe", postalCode: "85281" },
12
+ { name: "Peoria", postalCode: "85345" },
13
+ { name: "Surprise", postalCode: "85374" },
14
+ { name: "Yuma", postalCode: "85364" },
15
+ { name: "Avondale", postalCode: "85323" },
16
+ { name: "Goodyear", postalCode: "85338" },
17
+ { name: "Flagstaff", postalCode: "86001" },
18
+ { name: "Buckeye", postalCode: "85326" },
19
+ { name: "Lake Havasu City", postalCode: "86403" },
20
+ { name: "Casa Grande", postalCode: "85122" },
21
+ { name: "Sierra Vista", postalCode: "85635" },
22
+ { name: "Maricopa", postalCode: "85138" },
23
+ { name: "Oro Valley", postalCode: "85737" },
24
+ { name: "Prescott", postalCode: "86301" },
25
+ { name: "Bullhead City", postalCode: "86429" },
26
+ { name: "Prescott Valley", postalCode: "86314" },
27
+ { name: "Marana", postalCode: "85653" },
28
+ { name: "Apache Junction", postalCode: "85120" },
29
+ { name: "Queen Creek", postalCode: "85142" },
30
+ { name: "Kingman", postalCode: "86401" },
31
+ { name: "Payson", postalCode: "85541" },
32
+ { name: "San Luis", postalCode: "85349" },
33
+ { name: "Nogales", postalCode: "85621" },
34
+ ],
35
+ };
@@ -0,0 +1,38 @@
1
+ export const arkansas = {
2
+ name: "arkansas",
3
+ cities: [
4
+ { name: "Little Rock", postalCode: "72201" },
5
+ { name: "Fort Smith", postalCode: "72901" },
6
+ { name: "Fayetteville", postalCode: "72701" },
7
+ { name: "Springdale", postalCode: "72762" },
8
+ { name: "Jonesboro", postalCode: "72401" },
9
+ { name: "North Little Rock", postalCode: "72114" },
10
+ { name: "Conway", postalCode: "72032" },
11
+ { name: "Rogers", postalCode: "72756" },
12
+ { name: "Pine Bluff", postalCode: "71601" },
13
+ { name: "Bentonville", postalCode: "72712" },
14
+ { name: "Hot Springs", postalCode: "71901" },
15
+ { name: "Benton", postalCode: "72015" },
16
+ { name: "Sherwood", postalCode: "72120" },
17
+ { name: "Texarkana", postalCode: "71854" },
18
+ { name: "Russellville", postalCode: "72801" },
19
+ { name: "Bella Vista", postalCode: "72714" },
20
+ { name: "Paragould", postalCode: "72450" },
21
+ { name: "Cabot", postalCode: "72023" },
22
+ { name: "West Memphis", postalCode: "72301" },
23
+ { name: "Van Buren", postalCode: "72956" },
24
+ { name: "Searcy", postalCode: "72143" },
25
+ { name: "Bryant", postalCode: "72022" },
26
+ { name: "El Dorado", postalCode: "71730" },
27
+ { name: "Maumelle", postalCode: "72113" },
28
+ { name: "Hope", postalCode: "71801" },
29
+ { name: "Blytheville", postalCode: "72315" },
30
+ { name: "Morrilton", postalCode: "72110" },
31
+ { name: "Forrest City", postalCode: "72335" },
32
+ { name: "Helena-West Helena", postalCode: "72342" },
33
+ { name: "Camden", postalCode: "71701" },
34
+ { name: "Magnolia", postalCode: "71753" },
35
+ { name: "Harrison", postalCode: "72601" },
36
+ { name: "Mountain Home", postalCode: "72653" },
37
+ ],
38
+ };