Reference · British country module
RoyalMailFormattingOptionstype
Options for formatRoyalMail.
Import it
import type { RoyalMailFormattingOptions } from "@johnmorrisdotca/address-plus/gb";
Definition
interface RoyalMailFormattingOptions {
includeCounty?: boolean;
includeCountry?: boolean;
}
Members
| Name | Type | Description |
|---|---|---|
includeCounty (optional) | boolean | undefined | |
includeCountry (optional) | boolean | undefined |
Examples
import { formatRoyalMail, parseUKAddress } from "@johnmorrisdotca/address-plus/gb";
import type { RoyalMailFormattingOptions } from "@johnmorrisdotca/address-plus/gb";
const parsedAddress1=parseUKAddress("10 Downing Street, London SW1A 2AA");
if (!parsedAddress1) throw new Error("The example address did not parse.");
console.log(formatRoyalMail(parsedAddress1, { includeCountry: true }).lines);
// → ["10 Downing Street","LONDON","SW1A 2AA","UNITED KINGDOM"][ '10 Downing Street', 'LONDON', 'SW1A 2AA', 'UNITED KINGDOM' ]What it prints (run when this page was built)