use-postal-ph
Version:
This utility library is specifically designed for the Philippines, providing comprehensive information on postal codes, municipalities, locations, and regions. Moreover, searching within the library is case insensitive.
48 lines (45 loc) • 1.32 kB
text/typescript
type PlaceProps = {
municipality?: string;
location?: string;
post_code?: string | number;
region?: string;
};
type SearchCriteriaProps = {
search?: string | number;
limit?: number;
};
type PlaceListCriteriaProps = PlaceProps & {
limit?: number;
};
declare function usePostalPH(): {
fetchMunicipalities: ({ search, limit }?: SearchCriteriaProps) => {
data: PlaceProps[];
count: number;
} | {
data: string[];
count: number;
} | undefined;
fetchPostCodes: ({ search, limit }?: SearchCriteriaProps) => PlaceProps | {
data: number[];
count: number;
} | undefined;
fetchLocations: ({ search, limit }?: SearchCriteriaProps) => {
data: PlaceProps[];
count: number;
} | {
data: string[];
count: number;
} | undefined;
fetchRegions: ({ search, limit }?: SearchCriteriaProps) => {
data: PlaceProps[];
count: number;
} | {
data: string[];
count: number;
} | undefined;
fetchDataLists: ({ municipality, post_code, region, location, limit }?: PlaceListCriteriaProps) => {
data: PlaceProps[];
count: number;
};
};
export { type PlaceListCriteriaProps, type PlaceProps, type SearchCriteriaProps, usePostalPH as default };