world-countries-capitals
Table of Contents
- Introduction
- Demos
- Installation
- How to use
- Data model
- Available methods
- Contributing
- Core Team
- License
Introduction
World-Countries-Capitals is JavaScript Library that give access to static data
of all countries in the world.
Currently available data for each country is:
- country - country name
- capital - capital city
- currency - currency that is used
- native_language - list of official languages that are used in country
- famous_for - list of things that makes country famous for
- phone_code - country dial-in (calling) code
- flag - image of country flag
- drive_direction - drive direction
- alcohol_prohibition - status of alcohol prohibition
- area - country size (square kilometers and square miles)
- continent - 2-letter code of continent where the country is
- iso - country ISO 3166-1 code (numeric, alpha-2, alpha-3)
- tld - country code top-level domain
- constitutional_form - official political system
- language_codes - list of langauge codes (combination of ISO 639-1 and ISO 3166-1 alpha-2)
- is_landlocked - information whether country is surrounded by one or more countries
You can check all changes in the project at releases page on Github
or in changelog.
Feel free to give this project a ⭐️ if it helped you! 🤗
↑ Back to menu
Demos
Here are demos/examples created by community ❤️
↑ Back to menu
Installation
Install with NPM:
npm install world-countries-capitals
Install with Yarn:
yarn add world-countries-capitals
↑ Back to menu
How to use
Depends which way you choose to install this package,
there might be a different way to use it.
↑ Back to menu
Data model
Type definition of each Country {Object}
:
Sample Country {Object}
:
{
country: 'poland',
capital: 'warsaw',
currency: 'zloty',
native_language: ['polish'],
famous_for: 'pierogi and potatoes',
phone_code: '+48',
flag: 'https://flagpedia.net/data/flags/h80/pl.png',
drive_direction: 'right',
alcohol_prohibition: 'none',
area: {
km2: 312696,
mi2: 120733,
},
continent: 'eu',
iso: {
numeric: '616',
alpha_2: 'pl',
alpha_3: 'pol',
},
tld: '.pl',
constitutional_form: 'republic',
language_codes: ['pl-PL'],
is_landlocked: false
}
↑ Back to menu
Available methods
After importing world-countries-capitals Package,
you have access to methods listed below:
wcc.getAllCountries()
wcc.getAllCountryDetails()
wcc.getRandomCountry()
wcc.getNRandomCountriesData(amount)
wcc.getCountryDetailsByName(name)
wcc.getCountryDetailsByCapital(capital)
wcc.getCountriesByLanguage(language)
wcc.getCountriesByFamousFor(famousThing)
wcc.getCountriesByDriveDirection(direction)
wcc.getCountriesByAlcoholProhibition(type)
wcc.getCountriesByContinent(code)
wcc.getCountryDetailsByISO(isoType, isoValue)
wcc.getCountriesByTLD(tld)
wcc.getCountriesByConstitutionalForm(form)
wcc.getCountriesByLandLock(isLandLocked)
❗️ All params are NOT case sensitive so no matter how argument looks,
the response will remain the same.
↑ Back to menu
Contributing
Contributions, issues and feature requests are always welcome!
Feel free to check our issues page to see all open issues.
If this is your first time contributing to Open Source project,
check out the contributing guidelines first.
You can also suggest a new feature by creating an issue.
Please wait for confirmation before working on it.
↑ Back to menu
Core team
Vikrant Bhat
Damian Szczypka
If you'd like to see everyone who contributed to this project,
view the contributions page!
Thank you to everyone who contributes! 🙌
↑ Back to menu
License
Copyright © 2020 Vikrant Bhat.
This project is MIT licensed.
↑ Back to menu