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_NAMES_ENconstant

Every Canadian province and territory by its English name in lower case, to its two-letter code.

Import it

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

Definition

const CA_PROVINCE_NAMES_EN: Record<string, string> = {
    alberta: "AB",
    "british columbia": "BC",
    manitoba: "MB",
    "new brunswick": "NB",
    "newfoundland and labrador": "NL",
    "northwest territories": "NT",
    "nova scotia": "NS",
    nunavut: "NU",
    ontario: "ON",
    "prince edward island": "PE",
    quebec: "QC",
    saskatchewan: "SK",
    yukon: "YT",
}

Examples

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

console.log(CA_PROVINCE_NAMES_EN["british columbia"]);
// → "BC"
BC

What it prints (run when this page was built)

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