Reference · Parsing, formatting and shared types
POSTAL_CODE_TO_PROVINCEconstant
Each first letter of a Canadian postal code, to the province or territory it is assigned to. X is shared by the
Northwest Territories and Nunavut and is resolved with TERRITORY_POSTAL_RANGES.
Import it
import { POSTAL_CODE_TO_PROVINCE } from "@johnmorrisdotca/address-plus";
Definition
const POSTAL_CODE_TO_PROVINCE: Record<string, string> = {
A: "NL",
B: "NS",
C: "PE",
E: "NB",
G: "QC",
H: "QC",
J: "QC",
K: "ON",
L: "ON",
M: "ON",
N: "ON",
P: "ON",
R: "MB",
S: "SK",
T: "AB",
V: "BC",
X: "NT",
Y: "YT",
}
Examples
import { POSTAL_CODE_TO_PROVINCE } from "@johnmorrisdotca/address-plus";
console.log(POSTAL_CODE_TO_PROVINCE["V"]);
// → "BC"BCWhat it prints (run when this page was built)