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

findUKNationfunction

Finds a nation of the United Kingdom by its code (SCT, GB-SCT) or its name in English or Japanese.

Import it

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

Definition

function findUKNation(text: string): (typeof GB_NATIONS)[number] | null

Parameters

NameTypeDescription
textstring

The code or the name.

Returns

UKNation | null

The nation, or null when nothing matches.

Examples

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

console.log(findUKNation("wales")?.code);
// → "WLS"
WLS

What it prints (run when this page was built)

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