Reference · Japanese addresses
ParsedAddresstype
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 it
import type { ParsedAddress } from "@johnmorrisdotca/address-plus/jp";
Also exported from: @johnmorrisdotca/address-plus/au, @johnmorrisdotca/address-plus/gb, @johnmorrisdotca/address-plus/de, @johnmorrisdotca/address-plus/fr, @johnmorrisdotca/address-plus
Definition
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;
}
Members
| Name | Type | Description |
|---|---|---|
city (optional) | string | undefined | |
compartment (optional) | string | undefined | |
country (optional) | "CA" | "US" | "JP" | "AU" | "GB" | "GY" | "IM" | "JE" | FrenchPostalCountry | "DE" | undefined | |
fraction (optional) | string | undefined | |
generalDelivery (optional) | boolean | undefined | |
highwayContract (optional) | string | undefined | |
locality (optional) | string | undefined | |
military (optional) | string | undefined | |
number (optional) | string | undefined | |
place (optional) | string | undefined | |
plus4 (optional) | string | undefined | |
postalValid (optional) | boolean | undefined | |
postalType (optional) | "zip" | "postal" | undefined | |
prefix (optional) | string | undefined | |
rpo (optional) | string | undefined | |
rr (optional) | string | undefined | |
ruralRoute (optional) | string | undefined | |
secUnitNum (optional) | string | undefined | |
secUnitType (optional) | string | undefined | |
secondary (optional) | string | undefined | |
site (optional) | string | undefined | |
state (optional) | string | undefined | |
station (optional) | string | undefined | |
street (optional) | string | undefined | |
suffix (optional) | string | undefined | |
type (optional) | string | undefined | |
unit (optional) | string | undefined | |
zip (optional) | string | undefined | |
zipValid (optional) | boolean | undefined | |
postalCode (optional) | string | undefined | |
prefecture (optional) | string | undefined | |
prefectureCode (optional) | string | undefined | |
prefectureRomaji (optional) | string | undefined | |
municipality (optional) | string | undefined | |
municipalityCode (optional) | string | undefined | |
municipalityRomaji (optional) | string | undefined | |
streetDirections (optional) | string | undefined | |
town (optional) | string | undefined | |
chome (optional) | string | undefined | |
ban (optional) | string | undefined | |
go (optional) | string | undefined | |
block (optional) | string | undefined | |
building (optional) | string | undefined | |
floor (optional) | string | undefined | |
room (optional) | string | undefined | |
floorType (optional) | string | undefined | |
lot (optional) | string | undefined | |
numberExtension (optional) | string | undefined | |
staircase (optional) | string | undefined | |
entrance (optional) | string | undefined | |
lieuDit (optional) | string | undefined | |
postalBoxType (optional) | "BP" | "CS" | "TSA" | undefined | |
postalBoxNum (optional) | string | undefined | |
cedex (optional) | string | undefined | |
arrondissement (optional) | string | undefined | |
careOf (optional) | string | undefined | |
subBuilding (optional) | string | undefined | |
dependentThoroughfare (optional) | string | undefined | |
doubleDependentLocality (optional) | string | undefined | |
county (optional) | string | undefined | |
nation (optional) | UKNationCode | undefined | |
bfpo (optional) | string | undefined |
Examples
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'
}What it prints (run when this page was built)