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

Regiontype

A US state or Canadian province: its code, its country and its name, as normalizeRegion matches them.

Import it

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

Definition

type Region = {
    abbr: string;
    country: "CA" | "US";
    name: string;
};

Members

NameTypeDescription
abbrstring
country"CA" | "US"
namestring

Examples

import { CA_REGIONS } from "@johnmorrisdotca/address-plus";
import type { Region } from "@johnmorrisdotca/address-plus";

console.log(CA_REGIONS[0]);
// → {"abbr":"AB","country":"CA","name":"alberta"}
{ abbr: 'AB', country: 'CA', name: 'alberta' }

What it prints (run when this page was built)

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