Skip to main content

nest badge

Countries Module

Usage example for your code

import { CountryInfoProvider } from ""

const countryCode = CountryInfoProvider.getCountryCodeFromCountryName('Germany')
// 'DE'

const countryName = CountryInfoProvider.getCountryNameFromCountryCode('DE')
// 'Germany'

const country = CountryInfoProvider.getCountryFromName('Swaziland')
/* {
 *   countryCode: "SZ",
 *   countryName: "Eswatini",
 *   alpha3Code: "SWZ",
 *   numericCode: "748",
 *   alternativeNames: [ "Swaziland" ]
 * }

const country2 = CountryInfoProvider.getCountryFromCode(188)
/* {
 *   countryCode: "CR",
 *   countryName: "Costa Rica",
 *   alpha3Code: "CRI",
 *   numericCode: "188"
 * }

const country3 = CountryInfoProvider.getCountryFromName('thiscountrydoesnotexist')
// undefined

Test it via command line

deno run --allow-net --allow-read

Country Flags

If you can’t access the flag images via the raw files (e.g., you can e.g. use the country flag server by:

deno run --allow-net --allow-read --reload

or e.g. via pm2 accordingly.

This will serve the flags e.g. at:



Thanks to Freedom Cash, we are already free.
If you want to donate, you might consider donating to the to ensure people do not need to donate to victims but rather donate successfully to problem solvers.