Package Exports
- countries-api-json
- countries-api-json/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (countries-api-json) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
countries-api-json
A comprehensive list of countries and their details in JSON format. Useful for applications that need country data for various purposes such as dropdowns, validations, etc.
Installation
To install this package, run:
npm install countries-api-json
Usage
Here is a basic example of how to use this package:
const countries = require('countries-api-json');
// Example usage
console.log(countries); // Prints the entire list of countries
// Accessing specific country details
const zambia = countries.find(country => country.code === 'ZM');
console.log(zambia); // { name: 'Zambia', code: 'ZM', dial_code: '+260', flag: 'πΏπ²' }
API
The package exports a JSON array of country objects. Each country object contains the following properties:
name
(String): The name of the country.code
(String): The ISO 3166-1 alpha-2 code of the country.dial_code
(String): The international dialing code of the country.flag
(String): The flag emoji of the country.
Example Country Object
{
"name": "Zambia",
"code": "ZM",
"dial_code": "+260",
"flag": "πΏπ²"
}
Contributing
Contributions are welcome! Please open an issue or submit a pull request for any bugs or features.
- Fork the repository
- Create a new branch (
git checkout -b feature-branch
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin feature-branch
) - Open a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgements
- Thank you to everyone who has contributed to this project.