Continents & Currencies
← Back to docs
Continents
Import
import { continents, getContinentByCode } from "arevdata";
import type { Continent, ContinentName } from "arevdata";
Data shape
interface Continent {
name: ContinentName;
code: string;
population: number;
area: number;
countries: number;
}
type ContinentName =
| "Africa"
| "Antarctica"
| "Asia"
| "Europe"
| "North America"
| "Oceania"
| "South America";
Continent codes
| Code |
Name |
Countries |
Area (km²) |
AF |
Africa |
54 |
30,370,000 |
AN |
Antarctica |
0 |
14,200,000 |
AS |
Asia |
49 |
44,579,000 |
EU |
Europe |
44 |
10,530,000 |
NA |
North America |
23 |
24,709,000 |
OC |
Oceania |
14 |
8,526,000 |
SA |
South America |
12 |
17,840,000 |
Examples
import { continents, getContinentByCode } from "arevdata";
console.log(continents.length);
const europe = getContinentByCode("EU");
getContinentByCode("eu");
const byArea = [...continents].sort((a, b) => b.area - a.area);
byArea.map(c => c.name);
Use with countries
import { continents, getCountriesByContinent } from "arevdata";
const enriched = continents.map(continent => ({
...continent,
countryList: getCountriesByContinent(continent.name),
}));
Currencies
Import
import {
currencies,
getCurrencyByCode,
getCurrencyByCountry,
} from "arevdata";
import type { Currency } from "arevdata";
Data shape
interface Currency {
code: string;
name: string;
symbol: string;
countries: string[];
}
Examples
import { currencies, getCurrencyByCode, getCurrencyByCountry } from "arevdata";
console.log(currencies.length);
getCurrencyByCode("USD");
getCurrencyByCode("EUR");
getCurrencyByCode("usd");
getCurrencyByCountry("JP");
getCurrencyByCountry("DE");
List all countries using the Euro
import { getCurrencyByCode, getCountryByCode } from "arevdata";
const euro = getCurrencyByCode("EUR");
const eurozone = euro?.countries.map(code => getCountryByCode(code)?.name);
Build a currency selector
import { currencies } from "arevdata";
const currencyOptions = currencies.map(c => ({
value: c.code,
label: `${c.symbol} ${c.name} (${c.code})`,
}));
import { getCurrencyByCountry } from "arevdata";
function formatPrice(amount: number, countryCode: string): string {
const currency = getCurrencyByCountry(countryCode);
if (!currency) return String(amount);
return `${currency.symbol}${amount.toFixed(2)}`;
}
formatPrice(42.5, "US");
formatPrice(42.5, "JP");
formatPrice(42.5, "DE");
- Countries —
country.continent is a ContinentName; country.currency is an ISO 4217 code
- Geography —
countryGeography is keyed by the same alpha-2 codes used in currency.countries[]