countries-api-json 1.0.3 β 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/README.md +21 -15
- package/countries.json +388 -194
- package/index.d.ts +5 -4
- package/package.json +1 -1
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
|