Countries Data
Get All Countries
This gives you an array of all countries.
ES6 Module
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.
ES6 Module
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.
ES6 Module
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