Data & Assets
Countries
The countries array is the central dataset of arev. It contains ~195 sovereign states following the ISO 3166-1 standard, covering every continent.
Live country lookup
Import
import {
countries,
getCountryByCode,
getCountriesByContinent,
getCountryFlag,
} from "arevdata";
import type { Country, ContinentName } from "arevdata";
Data shape
interface Country {
name: string; // Full English name, e.g. "United States"
nativeName?: string; // Name in the country's own language (optional)
alpha2: string; // ISO 3166-1 alpha-2 (2-letter), e.g. "US"
alpha3: string; // ISO 3166-1 alpha-3 (3-letter), e.g. "USA"
numeric: string; // ISO 3166-1 numeric (zero-padded 3 digits), e.g. "840"
flag: string; // Unicode emoji flag, e.g. "πΊπΈ"
phoneCode: string; // International dialling prefix, e.g. "+1"
capital: string; // Name of the capital city, e.g. "Washington D.C."
continent: ContinentName; // "Africa"|"Antarctica"|"Asia"|"Europe"|"North America"|"Oceania"|"South America"
currency: string; // ISO 4217 currency code, e.g. "USD"
languages: string[]; // Primary languages, e.g. ["English"]
tld?: string; // Internet ccTLD, e.g. ".us"
}
Examples
All countries
import { countries } from "arevdata";
console.log(countries.length); // ~195
console.log(countries[0]);
// {
// name: "Afghanistan",
// alpha2: "AF", alpha3: "AFG", numeric: "004",
// flag: "π¦π«", phoneCode: "+93",
// capital: "Kabul", continent: "Asia",
// currency: "AFN", languages: ["Dari", "Pashto"],
// tld: ".af"
// }
Look up a country by alpha-2 code
import { getCountryByCode } from "arevdata";
const de = getCountryByCode("DE");
// { name: "Germany", alpha2: "DE", flag: "π©πͺ", capital: "Berlin", ... }
// Case-insensitive
getCountryByCode("de") === getCountryByCode("DE"); // true
// Returns undefined if not found
getCountryByCode("ZZ"); // undefined
Get all countries in a continent
import { getCountriesByContinent } from "arevdata";
const europeanCountries = getCountriesByContinent("Europe");
console.log(europeanCountries.length); // 44+
const africanCodes = getCountriesByContinent("Africa").map(c => c.alpha2);
// ["DZ", "AO", "BJ", ...]
Get the flag emoji for a country code
import { getCountryFlag } from "arevdata";
getCountryFlag("NL"); // "π³π±"
getCountryFlag("JP"); // "π―π΅"
getCountryFlag("us"); // "πΊπΈ" β case-insensitive
Build a country selector
import { countries } from "arevdata";
const options = countries.map((c) => ({
value: c.alpha2,
label: `${c.flag} ${c.name}`,
}));
// [{ value: "AF", label: "π¦π« Afghanistan" }, ...]
Get all European countries sorted alphabetically
import { getCountriesByContinent } from "arevdata";
const sorted = getCountriesByContinent("Europe")
.sort((a, b) => a.name.localeCompare(b.name));
Find the currency for a given country
import { getCountryByCode } from "arevdata";
const country = getCountryByCode("FR");
console.log(country?.currency); // "EUR"
Continent name values
type ContinentName =
| "Africa"
| "Antarctica"
| "Asia"
| "Europe"
| "North America"
| "Oceania"
| "South America";
Coverage
All 195 UN-recognised sovereign states are included, plus Kosovo. Antarctica has no countries but appears in the continents array.
| Continent | Countries |
|---|---|
| Africa | 54 |
| Asia | 49 |
| Europe | 44 |
| North America | 23 |
| South America | 12 |
| Oceania | 14 |
| Antarctica | 0 |
Related
- Phone codes β
phoneCountryCodesextends country data with territory entries - Geography β
countryGeographyadds centroids, bounds, and climate data per country - Flags β
flagDataadds SVG/PNG URLs, colours, and similar-flag groups per country - Cities β
citieshas capital and major city coordinates - Currencies β
getCurrencyByCountry()looks up currency from country code - Languages β official-language mappings and language selectors keyed by country code