Data Exports

Pre-filtered datasets for different regions and use cases

allCountries

Complete dataset of all 250 world countries.

Import

import { allCountries } from 'countries-cities-ar';

console.log(allCountries.length); // 250
console.log(allCountries[0].name); // "Afghanistan"
250
Countries
4,642
States
3
Languages
586KB
Size

Regional Datasets

Import only the regions you need for optimal bundle size.

africaCountries

54 African countries

import { africaCountries } from 'countries-cities-ar';
// Egypt, Nigeria, South Africa, Kenya, Morocco...

asiaCountries

49 Asian countries

import { asiaCountries } from 'countries-cities-ar';
// China, India, Saudi Arabia, UAE, Japan...

europeCountries

50 European countries

import { europeCountries } from 'countries-cities-ar';
// Germany, France, United Kingdom, Italy, Spain...

americasCountries

48 countries in the Americas

import { americasCountries } from 'countries-cities-ar';
// USA, Canada, Brazil, Mexico, Argentina...

oceaniaCountries

19 Oceanian countries

import { oceaniaCountries } from 'countries-cities-ar';
// Australia, New Zealand, Fiji, Papua New Guinea...

Optimized Import Strategy

// ❌ Avoid: Importing everything when you only need specific regions
import { allCountries } from 'countries-cities-ar';
const arabCountries = allCountries.filter(c => /* ... */);

// ✅ Better: Import only what you need
import { 
  africaCountries,
  asiaCountries 
} from 'countries-cities-ar';

// Combine regions if needed
const myCountries = [...africaCountries, ...asiaCountries];

// ✅ Best: Use specific functions for operations
import { getCountryByCode, searchCountries } from 'countries-cities-ar';

Tree Shaking

The library is fully tree-shakeable. Modern bundlers will automatically remove unused exports, so importing specific regions or functions will reduce your final bundle size.

Countries Cities AR

Documentation

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