js-locations
Version:
A simple Node.js library for accessing country, state, and city data.
35 lines (31 loc) • 860 B
TypeScript
declare module "js-locations" {
export interface Country {
id: number;
name: string;
iso2: string;
phone_code: string;
currency: string;
currency_symbol: string;
state: String[];
}
export interface State {
id: number;
name: string;
cities: City[];
}
export interface City {
id: number;
name: string;
}
export function getAllCountries(): Country[];
export function getCountryByName(name: string): Country | null;
export function getStatesByCountry(countryName: string): State[] | null;
export function getCitiesByState(
countryName: string,
stateName: string
): City[] | null;
export function getPhoneCodeByCountry(countryName: string): string | null;
export function getCurrencySymbolByCountry(
countryName: string
): string | null;
}