countries-names
A-Z list of countries for JavaScript Programmers. Supports NodeJS and all browsers
Installation
To use with node:
npm install countries-names
Then in the console:
const countriesNames = ;
To use directly in the browser:
or the minified version:
Usage
Returns an array of all country names and their codes. [{name:'Afghanistan', code: 'AF'},...]
all()
Returns an array of country names ['Afghanistan', 'Albania', ...]
names()
Returns an array of country codes ['AF', 'AL', ...]
codes()
Returns the country name which matches the country code, or undefined if no country matches.
nameByCode(code)
Returns the country code which matches the country name, or undefined if no code matches.
codeByName(country)