Understand the data structures
mainThe library organizes data into four main objects: continents, countries, languages, and currencies.
- Continents: Keyed by
TContinentCode(e.g.,AF,EU), mapping to the continent name. - Countries: Keyed by
TCountryCode(e.g.,UA), containingname,nativename,phoneprefix,continentcode,capital,currencyarray, andlanguagesarray. - Languages: Keyed by
TLanguageCode(e.g.,uk), containingname,nativename, andrtl(right-to-left) indicator. - Currencies: Keyed by
TCurrencyCode(e.g.,UAH), containingname,nativename,symbol,symbolNative,numericcode, anddecimalscount.
const continents = {
AF: 'Africa',
AN: 'Antarctica',
AS: 'Asia',
EU: 'Europe',
NA: 'North America',
OC: 'Oceania',
SA: 'South America',
}
const countries = {
UA: {
name: 'Ukraine',
native: 'Україна',
phone: [380],
continent: 'EU',
capital: 'Kyiv',
currency: ['UAH'],
languages: ['uk'],
},
}
const languages = {
uk: {
name: 'Ukrainian',
native: 'Українська',
},
ur: {
name: 'Urdu',
native: 'اردو',
rtl: 1,
},
}
const currencies = {
UAH: {
name: 'Ukrainian Hryvnia',
native: 'українська гривня',
symbol: '₴',
symbolNative: '₴',
numeric: '980',
decimals: 2,
},
}