ParsedAddress型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
What parseLocation returns: every part it found, each absent when the address has none. A Japanese address fills
its own fields and the shared ones that stand for them: state the prefecture's JIS code, city the municipality,
street the town, number the block, zip the postal code.
インポート
import type { ParsedAddress } from "@johnmorrisdotca/address-plus/jp";
ほかのエクスポート元: @johnmorrisdotca/address-plus/au, @johnmorrisdotca/address-plus/gb, @johnmorrisdotca/address-plus/de, @johnmorrisdotca/address-plus/fr, @johnmorrisdotca/address-plus
定義
interface ParsedAddress extends JapaneseAddressFields, AustralianAddressFields, FrenchAddressFields, UKAddressFields {
city?: string;
compartment?: string;
country?: "CA" | "US" | "JP" | "AU" | "GB" | "GY" | "IM" | "JE" | FrenchPostalCountry | "DE";
fraction?: string;
generalDelivery?: boolean;
highwayContract?: string;
locality?: string;
military?: string;
number?: string;
place?: string;
plus4?: string;
postalValid?: boolean;
postalType?: "zip" | "postal";
prefix?: string;
rpo?: string;
rr?: string;
ruralRoute?: string;
secUnitNum?: string;
secUnitType?: string;
secondary?: string;
site?: string;
state?: string;
station?: string;
street?: string;
suffix?: string;
type?: string;
unit?: string;
zip?: string;
zipValid?: boolean;
}
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
city (省略可) | string | undefined | |
compartment (省略可) | string | undefined | |
country (省略可) | "CA" | "US" | "JP" | "AU" | "GB" | "GY" | "IM" | "JE" | FrenchPostalCountry | "DE" | undefined | |
fraction (省略可) | string | undefined | |
generalDelivery (省略可) | boolean | undefined | |
highwayContract (省略可) | string | undefined | |
locality (省略可) | string | undefined | |
military (省略可) | string | undefined | |
number (省略可) | string | undefined | |
place (省略可) | string | undefined | |
plus4 (省略可) | string | undefined | |
postalValid (省略可) | boolean | undefined | |
postalType (省略可) | "zip" | "postal" | undefined | |
prefix (省略可) | string | undefined | |
rpo (省略可) | string | undefined | |
rr (省略可) | string | undefined | |
ruralRoute (省略可) | string | undefined | |
secUnitNum (省略可) | string | undefined | |
secUnitType (省略可) | string | undefined | |
secondary (省略可) | string | undefined | |
site (省略可) | string | undefined | |
state (省略可) | string | undefined | |
station (省略可) | string | undefined | |
street (省略可) | string | undefined | |
suffix (省略可) | string | undefined | |
type (省略可) | string | undefined | |
unit (省略可) | string | undefined | |
zip (省略可) | string | undefined | |
zipValid (省略可) | boolean | undefined | |
postalCode (省略可) | string | undefined | |
prefecture (省略可) | string | undefined | |
prefectureCode (省略可) | string | undefined | |
prefectureRomaji (省略可) | string | undefined | |
municipality (省略可) | string | undefined | |
municipalityCode (省略可) | string | undefined | |
municipalityRomaji (省略可) | string | undefined | |
streetDirections (省略可) | string | undefined | |
town (省略可) | string | undefined | |
chome (省略可) | string | undefined | |
ban (省略可) | string | undefined | |
go (省略可) | string | undefined | |
block (省略可) | string | undefined | |
building (省略可) | string | undefined | |
floor (省略可) | string | undefined | |
room (省略可) | string | undefined | |
floorType (省略可) | string | undefined | |
lot (省略可) | string | undefined | |
numberExtension (省略可) | string | undefined | |
staircase (省略可) | string | undefined | |
entrance (省略可) | string | undefined | |
lieuDit (省略可) | string | undefined | |
postalBoxType (省略可) | "BP" | "CS" | "TSA" | undefined | |
postalBoxNum (省略可) | string | undefined | |
cedex (省略可) | string | undefined | |
arrondissement (省略可) | string | undefined | |
careOf (省略可) | string | undefined | |
subBuilding (省略可) | string | undefined | |
dependentThoroughfare (省略可) | string | undefined | |
doubleDependentLocality (省略可) | string | undefined | |
county (省略可) | string | undefined | |
nation (省略可) | UKNationCode | undefined | |
bfpo (省略可) | string | undefined |
例
import { parseLocation } from "@johnmorrisdotca/address-plus";
import type { ParsedAddress } from "@johnmorrisdotca/address-plus/jp";
console.log(parseLocation("123 Main St Apt 4, Anytown, NY 12345"));
// → {"number":"123","secUnitType":"Apartment","secUnitNum":"4","unit":"Apt 4","street":"Main","type":"St","city":"Anytown","state":"NY","zip":"12345","zipValid":true,"country":"US"}{
number: '123',
secUnitType: 'Apartment',
secUnitNum: '4',
unit: 'Apt 4',
street: 'Main',
type: 'St',
city: 'Anytown',
state: 'NY',
zip: '12345',
zipValid: true,
country: 'US'
}出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。