use-postal-jp
Version:
郵便番号を住所に変換するReactカスタムフックです。住所データを内部に持たず、APIで住所変換するため軽量なパッケージになっています。
14 lines (13 loc) • 507 B
TypeScript
import { APIResponse } from './endpoint';
export declare type Address = {
prefectureCode: string;
prefecture: string;
address1: string;
address2: string;
address3: string;
address4: string;
};
export declare const sanitize: (code: string | number) => [string, string];
export declare const makeRequestURL: ([first, second]: [string, string]) => string;
export declare type ParseResponse<T, R> = (res: R) => T;
export declare const parseResponse: ParseResponse<Address, APIResponse>;