Reference · Parsing, formatting and shared types
CanadaPostFormattingOptionstype
Options for formatCanadaPost: which lines to include, bilingual labels, and whether to set the letter case the
Canada Post way.
Import it
import type { CanadaPostFormattingOptions } from "@johnmorrisdotca/address-plus";
Definition
interface CanadaPostFormattingOptions {
includeDeliveryLine?: boolean;
includeLastLine?: boolean;
bilingualLabels?: boolean;
standardizeCase?: boolean;
}
Members
| Name | Type | Description |
|---|---|---|
includeDeliveryLine (optional) | boolean | undefined | |
includeLastLine (optional) | boolean | undefined | |
bilingualLabels (optional) | boolean | undefined | |
standardizeCase (optional) | boolean | undefined |
Examples
import { formatCanadaPost, parseLocation } from "@johnmorrisdotca/address-plus";
import type { CanadaPostFormattingOptions } from "@johnmorrisdotca/address-plus";
const parsedAddress1=parseLocation("100 Queen St W, Toronto, ON M5H 2N2");
if (!parsedAddress1) throw new Error("The example address did not parse.");
console.log(formatCanadaPost(parsedAddress1, { includeDeliveryLine: false }).lines);
// → ["TORONTO ON M5H 2N2"][ 'TORONTO ON M5H 2N2' ]What it prints (run when this page was built)