Functions

Complete API reference for all available functions

getCountryByCode

Get a country by its ISO country code.

Signature

getCountryByCode(code: string): Country | undefined

Parameters

  • code - Country ISO code (e.g., EG, SA)

Example

const egypt = getCountryByCode('EG');
console.log(egypt?.nameAr); // "مصر"
console.log(egypt?.cities.length); // 27

searchCountries

Search for countries by name in any language.

Signature

searchCountries(query: string, lang?: Language): Country[]

Example

const results = searchCountries('egy');
// Returns: [{ code: 'EG', name: 'Egypt', ... }]

const arabicResults = searchCountries('مصر', 'ar');
// Returns Egypt when searching in Arabic

getAllArabCountries

Get all Arab countries with complete Arabic translations.

Signature

getAllArabCountries(): Country[]

Example

const arabCountries = getAllArabCountries();
console.log(arabCountries.length); // 22 countries
// Includes: EG, SA, AE, IQ, SY, JO, LB, KW, OM, QA, YE, etc.

Countries Cities AR

Documentation

Version
v3.0.1
250 دولة • 4,642 محافظة