Reference · Parsing, formatting and shared types
getPostalPrefixesForProvincefunction
The postal code prefixes a province or territory uses, the reverse of getProvinceFromPostalCode. Every code
starting with one of them belongs to that province.
Import it
import { getPostalPrefixesForProvince } from "@johnmorrisdotca/address-plus";
Definition
function getPostalPrefixesForProvince(province: string): string[]
Parameters
| Name | Type | Description |
|---|---|---|
province | string | The province or territory's two-letter code. |
Returns
string[]
The prefixes, a letter or, for the territories, three characters; an empty array for an unknown code.
Examples
import { getPostalPrefixesForProvince } from "@johnmorrisdotca/address-plus";
console.log(getPostalPrefixesForProvince("NU"));
// → ["X0A","X0B","X0C"][ 'X0A', 'X0B', 'X0C' ]What it prints (run when this page was built)