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

TERRITORY_POSTAL_PREFIXESconstant

The first three characters of each territory's postal codes, since the territories share a first letter.

Import it

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

Definition

const TERRITORY_POSTAL_PREFIXES: Record<string, string[]> = {
    NU: ["X0A", "X0B", "X0C"],
    NT: ["X0E", "X0G", "X1A"],
    YT: ["Y"],
}

Examples

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

console.log(TERRITORY_POSTAL_PREFIXES["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.