@anouluk/laos-address-typescript
Version:
TypeScript utility for Lao addresses
60 lines (59 loc) • 1.82 kB
TypeScript
interface Province {
pid: string;
pn: string;
pn_en: string;
}
interface District {
did: string;
pid: string;
dn: string;
dn_en: string;
}
interface Village {
vid: string;
did: string;
vn: string;
vn_en: string;
}
interface AddressQuery {
province?: string | number | boolean | null;
district?: string | number | boolean | null;
village?: string | number | boolean | null;
}
/**
* Get a province by its ID
*/
declare const getProvinceValueByID: (id: string | number, existData?: Province[] | null) => Province | undefined;
/**
* Get a district by its ID
*/
declare const getDistrictValueByID: (id: string | number, existData?: District[] | null) => District | undefined;
/**
* Get a village by its ID
*/
declare const getVillageNameById: (id: string | number, existData?: Village[] | null) => Village | undefined;
/**
* Get all districts
*/
declare const getDistricts: () => District[];
/**
* Get all villages
*/
declare const getVillages: () => Village[];
/**
* Get all provinces
*/
declare const getProvinces: () => Province[];
/**
* Get districts by province ID
*/
declare const getDistrictsByProvinceId: (id: string | number, existData?: District[] | null) => District[];
/**
* Get villages by district ID
*/
declare const getVillagesByDistrictId: (id: string | number, existData?: Village[] | null) => Village[];
/**
* Get Lao addresses based on criteria
*/
declare const getLaoAddress: ({ province, district, village }: AddressQuery) => Province | Province[] | District | District[] | Village | Village[] | string;
export { getLaoAddress, getProvinces, getDistricts, getVillages, getProvinceValueByID, getDistrictValueByID, getVillageNameById, getDistrictsByProvinceId, getVillagesByDistrictId, Province, District, Village, AddressQuery };