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

CA_PROVINCE_ALTERNATIVESconstant

Other ways Canadian provinces are written (old and informal abbreviations such as PQ, Que., Nfld.), in lower case, to their codes.

Import it

import { CA_PROVINCE_ALTERNATIVES } from "@johnmorrisdotca/address-plus";

Definition

const CA_PROVINCE_ALTERNATIVES: Record<string, string> = {
    alb: "AB",
    alta: "AB",
    man: "MB",
    newfoundland: "NL",
    nf: "NL",
    nfld: "NL",
    labrador: "NL",
    "terre-neuve": "NL",
    "terre neuve": "NL",
    "terre neuve et labrador": "NL",
    tnl: "NL",
    northwest: "NT",
    territories: "NT",
    territoires: "NT",
    nwt: "NT",
    "tn-o": "NT",
    nvt: "NU",
    ont: "ON",
    pei: "PE",
    "prince edward": "PE",
    "ile-du-prince-édouard": "PE",
    "île du prince édouard": "PE",
    "ile du prince édouard": "PE",
    îpé: "PE",
    pq: "QC",
    que: "QC",
    sask: "SK",
}

Examples

import { CA_PROVINCE_ALTERNATIVES } from "@johnmorrisdotca/address-plus";

console.log(CA_PROVINCE_ALTERNATIVES["pq"]);
// → "QC"
QC

What it prints (run when this page was built)

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