countries-api-json 1.0.2 β 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +21 -15
- package/countries.json +388 -194
- package/index.d.ts +12 -0
- package/package.json +3 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Yash Chandnani
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -9,15 +9,15 @@ A comprehensive list of countries and their details in JSON format. Useful for a
|
|
|
9
9
|
|
|
10
10
|
To install this package, run:
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
\`\`\`bash
|
|
13
13
|
npm install countries-api-json
|
|
14
|
-
|
|
14
|
+
\`\`\`
|
|
15
15
|
|
|
16
16
|
## Usage
|
|
17
17
|
|
|
18
18
|
Here is a basic example of how to use this package:
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
\`\`\`javascript
|
|
21
21
|
const countries = require('countries-api-json');
|
|
22
22
|
|
|
23
23
|
// Example usage
|
|
@@ -25,37 +25,43 @@ console.log(countries); // Prints the entire list of countries
|
|
|
25
25
|
|
|
26
26
|
// Accessing specific country details
|
|
27
27
|
const zambia = countries.find(country => country.code === 'ZM');
|
|
28
|
-
console.log(zambia);
|
|
29
|
-
|
|
28
|
+
console.log(zambia);
|
|
29
|
+
// { name: 'Zambia', code: 'ZM', dial_code: '+260', flag: 'πΏπ²', flag_url: 'https://flagcdn.com/w40/zm.png' }
|
|
30
|
+
|
|
31
|
+
// Using flag_url (works on all platforms including Windows)
|
|
32
|
+
console.log(zambia.flag_url); // https://flagcdn.com/w40/zm.png
|
|
33
|
+
\`\`\`
|
|
30
34
|
|
|
31
35
|
## API
|
|
32
36
|
|
|
33
37
|
The package exports a JSON array of country objects. Each country object contains the following properties:
|
|
34
38
|
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
+
- \`name\` (String): The name of the country.
|
|
40
|
+
- \`code\` (String): The ISO 3166-1 alpha-2 code of the country.
|
|
41
|
+
- \`dial_code\` (String): The international dialing code of the country.
|
|
42
|
+
- \`flag\` (String): The flag emoji of the country.
|
|
43
|
+
- \`flag_url\` (String): The flag image URL of the country (works on all platforms including Windows).
|
|
39
44
|
|
|
40
45
|
### Example Country Object
|
|
41
46
|
|
|
42
|
-
|
|
47
|
+
\`\`\`json
|
|
43
48
|
{
|
|
44
49
|
"name": "Zambia",
|
|
45
50
|
"code": "ZM",
|
|
46
51
|
"dial_code": "+260",
|
|
47
|
-
"flag": "πΏπ²"
|
|
52
|
+
"flag": "πΏπ²",
|
|
53
|
+
"flag_url": "https://flagcdn.com/w40/zm.png"
|
|
48
54
|
}
|
|
49
|
-
|
|
55
|
+
\`\`\`
|
|
50
56
|
|
|
51
57
|
## Contributing
|
|
52
58
|
|
|
53
59
|
Contributions are welcome! Please open an issue or submit a pull request for any bugs or features.
|
|
54
60
|
|
|
55
61
|
1. Fork the repository
|
|
56
|
-
2. Create a new branch (
|
|
57
|
-
3. Commit your changes (
|
|
58
|
-
4. Push to the branch (
|
|
62
|
+
2. Create a new branch (\`git checkout -b feature-branch\`)
|
|
63
|
+
3. Commit your changes (\`git commit -am 'Add some feature'\`)
|
|
64
|
+
4. Push to the branch (\`git push origin feature-branch\`)
|
|
59
65
|
5. Open a pull request
|
|
60
66
|
|
|
61
67
|
## License
|