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

looksBritishfunction

Whether an address is surely British, with no hint: it ends with the United Kingdom or one of its nations (or Jersey, Guernsey or the Isle of Man), or it holds a full postcode in Royal Mail's grammar whose area Royal Mail uses, or BFPO and a number. A Canadian postal code never passes: it ends in a digit (M5V 1A1), a British postcode in two letters (W1A 0AX).

Import it

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

Definition

function looksBritish(text: string): boolean

Parameters

NameTypeDescription
textstring

The address as one string.

Returns

boolean

true when the address is British beyond doubt, false otherwise.

Examples

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

console.log([looksBritish("10 Downing Street, London SW1A 2AA"), looksBritish("100 Queen St W, Toronto, ON M5H 2N2")]);
// → [true,false]
[ true, false ]

What it prints (run when this page was built)

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