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

SubRegiontype

An administrative part of a city (a borough, a parish, a ward, an arrondissement) that may be written where the city is expected.

Import it

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

Definition

interface SubRegion {
    name: string;
    parentCity: string;
    state: string;
    country: "US" | "CA";
    type: "borough" | "parish" | "district" | "ward" | "arrondissement" | "quadrant";
    aliases?: string[];
}

Members

NameTypeDescription
namestring
parentCitystring
statestring
country"CA" | "US"
type"arrondissement" | "borough" | "parish" | "district" | "ward" | "quadrant"
aliases (optional)string[] | undefined

Examples

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

console.log(({ name: "brooklyn", parentCity: "new york", state: "NY", country: "US", type: "borough" }).type);
// → "borough"
borough

What it prints (run when this page was built)

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