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
| Name | Type | Description |
|---|---|---|
text | string | 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)