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

UKPostcodeAreatype

A postcode area: the town Royal Mail names it for, the country it delivers to (GB, or JE, GY and IM for the Crown Dependencies), and for the United Kingdom the nation, absent for an area that is not a place (BF, BX).

Import it

import type { UKPostcodeArea } from "@johnmorrisdotca/address-plus/gb";

Definition

interface UKPostcodeArea {
    name: string;
    country: "GB" | "GY" | "IM" | "JE";
    nation?: UKNationCode;
}

Members

NameTypeDescription
namestring
country"GB" | "GY" | "IM" | "JE"
nation (optional)UKNationCode | undefined

Examples

import { GB_POSTCODE_AREAS } from "@johnmorrisdotca/address-plus/gb";
import type { UKPostcodeArea } from "@johnmorrisdotca/address-plus/gb";

console.log(GB_POSTCODE_AREAS.BT);
// → {"name":"Northern Ireland","country":"GB","nation":"NIR"}
{ name: 'Northern Ireland', country: 'GB', nation: 'NIR' }

What it prints (run when this page was built)

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