Skip to the content

address-plusアドレスプラス

Parse, validate, format and compare addresses locally, add country modules and mount an optional native form field.

address-plus extends the parse-address style with typed results, validation, formatting and country modules. About the name

Contents

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

NameTypeDescription
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"
Kingsbury

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/address-plus 1.7.0.