UNPKG

countries-ts

Version:

A powerful TypeScript library with 60+ functions for country data - search, validate, format, compare, and more. Zero dependencies.

99 lines (98 loc) 5.29 kB
import { Country, CountryStats, RegionInfo, CurrencyInfo, LanguageInfo } from './country.interface'; export declare const getByCodeArea: (region: string) => Country[]; export declare const getByCode: (code: string) => Country | undefined; export declare const getByAlpha2: (alpha2: string) => Country | undefined; export declare const getByAlpha3: (alpha3: string) => Country | undefined; export declare const getByCountry: (countryName: string) => Country | undefined; export declare const getByCurrency: (currencyCode: string) => Country[]; export declare const getByLanguage: (languageCode: string) => Country[]; export declare const getByCountryCode: (countryCode: string) => Country | undefined; export declare const listCountries: () => Country[]; export declare const searchCountries: (query: string, fields?: (keyof Country)[]) => Country[]; export declare const getByMultipleCodes: (codes: string[]) => Country[]; export declare const getByCurrencySymbol: (symbol: string) => Country[]; export declare const getRegions: () => string[]; export declare const getCountriesByRegions: (regions: string[]) => Country[]; export declare const getRegionStats: () => { region: string; count: number; }[]; export declare const getCurrencies: () => Array<{ code: string; label: string; symbol: string | null; }>; export declare const getCountriesUsingCurrency: (currencyCode: string) => number; export declare const getLanguages: () => Array<{ code: string; label: string; }>; export declare const getCountriesByLanguages: (languageCodes: string[]) => Country[]; export declare const isValidCountryCode: (code: string) => boolean; export declare const isValidCurrencyCode: (code: string) => boolean; export declare const isValidPhoneCode: (phoneCode: string) => boolean; export declare const formatCountryName: (code: string, format?: 'full' | 'short') => string | undefined; export declare const formatPhoneNumber: (phoneNumber: string, countryCode: string) => string | undefined; export declare const compareCountries: (code1: string, code2: string) => { sameRegion: boolean; sameCurrency: boolean; sameLanguage: boolean; } | undefined; export declare const getNeighboringCountries: (code: string) => Country[]; export declare const sortCountriesBy: (field: keyof Country | 'currency.code' | 'language.code', order?: 'asc' | 'desc') => Country[]; export declare const getRandomCountry: () => Country; export declare const getRandomCountries: (count: number) => Country[]; export declare const getFlagUrl: (code: string, size?: '48x36' | '96x72' | '192x144') => string | undefined; export declare const getCapitals: () => Array<{ country: string; capital: string; }>; export declare const getCountryByCapital: (capital: string) => Country | undefined; export declare const getByIsoCode: (isoCode: string) => Country | undefined; export declare const getIsoCodeMapping: () => { [key: string]: string; }; export interface SearchFilters { regions?: string[]; currencies?: string[]; languages?: string[]; minPopulation?: number; maxPopulation?: number; minArea?: number; maxArea?: number; } export declare const searchCountriesAdvanced: (query: string, filters?: SearchFilters) => Country[]; export declare const getCountriesInTimezone: (timezone: string) => Country[]; export declare const getCountriesByCoordinates: (lat: number, lng: number, radiusKm: number) => Country[]; export declare const getDistanceBetweenCountries: (code1: string, code2: string) => number | undefined; export declare const getBorderingCountries: (code: string) => Country[]; export declare const areBorderingCountries: (code1: string, code2: string) => boolean; export declare const getMostPopulousCountries: (limit?: number) => Country[]; export declare const getLeastPopulousCountries: (limit?: number) => Country[]; export declare const getLargestCountries: (limit?: number) => Country[]; export declare const getSmallestCountries: (limit?: number) => Country[]; export declare const getPopulationDensity: (code: string) => number | undefined; export declare const getCountryStatistics: () => CountryStats; export declare const getByDemonym: (demonym: string) => Country | undefined; export declare const getDemonyms: () => Array<{ country: string; demonym: string; }>; export declare const getByNativeName: (nativeName: string) => Country | undefined; export declare const getNativeNames: () => Array<{ country: string; nativeName: string; }>; export declare const getSubregions: () => string[]; export declare const getCountriesBySubregion: (subregion: string) => Country[]; export declare const exportCountriesToCSV: () => string; export declare const exportCountriesToJSON: (pretty?: boolean) => string; export declare const getCountriesBatch: (codes: string[]) => (Country | undefined)[]; export declare const validateCountryCodes: (codes: string[]) => { valid: string[]; invalid: string[]; }; export declare const getRegionName: (regionCode: string) => string; export declare const getRegionsWithNames: () => RegionInfo[]; export declare const getCurrencyDetails: (currencyCode: string) => CurrencyInfo | undefined; export declare const getLanguageDetails: (languageCode: string) => LanguageInfo | undefined;