countries-region
Version:
A comprehensive library for countries and regions data with TypeScript support
67 lines (66 loc) • 2.3 kB
TypeScript
import { Country, Region } from './types';
import { countries } from './data/countries';
import { regions } from './data/regions';
import { getAirports } from './modules/airports';
import type { Airport } from './modules/airports';
/**
* Get all countries
* @returns Array of all countries
*/
export declare function getCountries(): Country[];
/**
* Get all regions
* @returns Array of all regions
*/
export declare function getRegions(): Region[];
/**
* Get countries by region
* @param regionSlug - The slug of the region to filter by
* @returns Array of countries in the specified region
*/
export declare function countriesOfRegion(regionSlug: string): Country[];
/**
* Get countries by subregion
* @param subregion - The name of the subregion to filter by
* @returns Array of countries in the specified subregion
*/
export declare function countriesOfSubRegion(subregion: string): Country[];
/**
* Find a country by its code (2-letter ISO code)
* @param code - The 2-letter ISO code of the country
* @returns The country object or undefined if not found
*/
export declare function countryByISO2(code: string): Country | undefined;
/**
* Find a country by its 3-letter ISO code
* @param code3 - The 3-letter ISO code of the country
* @returns The country object or undefined if not found
*/
export declare function countryByISO3(code3: string): Country | undefined;
/**
* Find a country by its slug
* @param slug - The slug of the country
* @returns The country object or undefined if not found
*/
export declare function countryBySlug(slug: string): Country | undefined;
/**
* Search countries by name
* @param query - The search query
* @returns Array of countries that match the search query
*/
export declare function countryByName(query: string): Country[];
/**
* Find a region by its slug
* @param slug - The slug of the region
* @returns The region object or undefined if not found
*/
export declare function regionBySlug(slug: string): Region | undefined;
/**
* Search regions by its name
* @param query - The slug of the region
* @returns The array of regions that match the search query
*/
export declare function regionsByName(query: string): Region[];
export { Country, Region };
export { countries, regions };
export { Airport, getAirports };