Skip to the content

address-plusアドレスプラス

Parse, validate, format and compare addresses locally, add country modules and mount an optional native form field.

address-plus extends the parse-address style with typed results, validation, formatting and country modules. About the name

Contents

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

NameTypeDescription
provincestring

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)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/address-plus 1.7.0.