Reference · British country module
UKAddressFieldstype
The fields an address in the United Kingdom fills beside the shared ones. The shared fields keep their meaning:
number is the building number, street and type the thoroughfare's name and its descriptor in full (Upper and
Street, as Royal Mail writes it), secUnitType and secUnitNum a flat or unit (Flat 2) or a PO Box, building
the building's name, locality the dependent locality, city the post town and zip the postcode.
Import it
import type { UKAddressFields } from "@johnmorrisdotca/address-plus/gb";
Also exported from: @johnmorrisdotca/address-plus
Definition
interface UKAddressFields {
subBuilding?: string;
dependentThoroughfare?: string;
doubleDependentLocality?: string;
county?: string;
nation?: UKNationCode;
bfpo?: string;
}
Members
| Name | Type | Description |
|---|---|---|
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 { parseUKAddress } from "@johnmorrisdotca/address-plus/gb";
import type { UKAddressFields } from "@johnmorrisdotca/address-plus/gb";
console.log(parseUKAddress("Flat 2, Rose Court, 14 High Street, Kingsbury, LONDON NW9 0AA")?.locality);
// → "Kingsbury"KingsburyWhat it prints (run when this page was built)