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

getNationsForUKPostcodefunction

Every nation a postcode's district delivers to: one for most, two for the districts along the borders of Wales and of Scotland (from Code-Point Open), the nation with most of the district's postcodes first.

Import it

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

Definition

function getNationsForUKPostcode(postcode: string): UKNationCode[]

Parameters

NameTypeDescription
postcodestring

The postcode.

Returns

UKNationCode[]

The nations; an empty array outside the United Kingdom or for text that is not a postcode.

Examples

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

console.log(getNationsForUKPostcode("SY10 7AA"));
// → ["ENG","WLS"]
[ 'ENG', 'WLS' ]

What it prints (run when this page was built)

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