use-country-info
Version:
use-country-info
138 lines (136 loc) • 3.29 kB
TypeScript
type TCountryInfo = {
name?: {
common?: string;
official?: string;
nativeName?: {
[code: string]: {
official?: string;
common?: string;
};
};
};
tld?: string[];
cca2?: string;
ccn3?: string;
cca3?: string;
cioc?: string;
independent?: boolean;
status?: string;
unMember?: boolean;
currencies?: {
[code: string]: {
name?: string;
symbol?: string;
};
};
countryCallingCode?: {
root?: string;
suffixes?: string[];
};
capital?: string[];
altSpellings?: string[];
region?: string;
subregion?: string;
languages?: {
[code: string]: string;
};
latlng?: [number, number];
landlocked?: boolean;
borders?: string[];
area?: number;
demonyms?: {
eng?: {
f?: string;
m?: string;
};
fra?: {
f?: string;
m?: string;
};
};
flag?: string;
maps?: {
googleMaps?: string;
openStreetMaps?: string;
};
population?: number;
gini: {
[year: number]: number;
};
fifa?: string;
car?: {
signs?: string[];
side?: string;
};
timezones?: string[];
continents?: string[];
flags?: {
png?: string;
svg?: string;
alt?: string;
};
coatOfArms?: {
png?: string;
svg?: string;
};
startOfWeek?: string;
capitalInfo?: {
latlng?: number[];
};
postalCode?: {
format?: string;
regex?: string;
};
};
type TCountryFlags = {
name?: {
common?: string;
official?: string;
};
flag?: string;
flags?: {
png?: string;
svg?: string;
alt?: string;
};
};
type TDdiInfo = {
countryCallingCode?: {
root?: string;
suffixes?: string[];
};
flags?: {
png?: string;
svg?: string;
alt?: string;
};
flag?: string;
cca3?: string;
};
/**
* Hook for accessing country information.
* Returns various functions to retrieve country data based on different criteria.
*/
export const useCountryInfo: () => {
allCountryInfo: TCountryInfo[];
ddiInfo: TDdiInfo[];
countryflags: TCountryFlags[];
Border: (searchedBorder: string) => TCountryInfo[];
Name: (name: string) => TCountryInfo | null;
Flag: (name: string) => TCountryInfo;
Region: (region: string) => TCountryInfo[];
SubRegion: (subregion: string) => TCountryInfo[];
Language: (language: string) => TCountryInfo[];
Currency: (currency: string) => TCountryInfo[];
CallingCode: (callingCode: string) => TCountryInfo;
Timezone: (timezone: string) => TCountryInfo[];
Capital: (capital: string) => TCountryInfo[];
Population: (population: number) => TCountryInfo[];
Area: (area: number) => TCountryInfo[];
Demonym: (demonym: string) => TCountryInfo[];
LatitudAndLongitud: (latitude: number, longitude: number) => TCountryInfo[];
Gini: (gini: number) => TCountryInfo[];
Fifa: (fifaName: string) => TCountryInfo;
Cca3: (cca3: string) => TCountryInfo;
};
//# sourceMappingURL=index.d.ts.map