Skip to Content
Version 0.0.1 is released 🎉
DocumentationCountries

Countries Data

Get All Countries

This gives you an array of all countries.

countries.ts
import { Countries } from 'countries-geo'; console.log(Countries.getAll); // Logs all Countries (e.g., [{ iso: "GH", name: "Ghana" }, ...])

By default this is sorted by name.

Get All Countries sorted by isoCode

This gives you an array of all countries specifically sorted by isoCode.

countries.ts
import { Countries } from 'countries-geo'; console.log(Countries.sortByIsoCode); // Logs all Countries (e.g., [{ iso: "AF", name: "Africa" }, ...])

By default this is sorted by iso.

Get Countries by Continent

This gives you an array of all countries filtered by a Continent isoCode.

countries.ts
import { Countries } from 'countries-geo'; console.log(Countries.getByContinent('AF')); // Logs all Countries (e.g., [{ iso: "GH", name: "Ghana" }, ...])

By default this is sorted by name.

Last updated on