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 · /it

italyconstant

Italy's module, for parseLocation and validateAddress: pass it in countries, and an address that ends with Italy, Italia or IT, or has an Italian street's type and a postcode of five digits and a place on its last line, is read as Italian; country: "IT" reads any address as one.

Import it

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

Definition

const italy: CountryModule = postcodeCountryModule(italianSpec, (address) => formatPosteItaliane(address))

Examples

import { parseLocation } from "@johnmorrisdotca/address-plus";
import { italy } from "@johnmorrisdotca/address-plus/it";

console.log(parseLocation("Via del Corso, 12/A, 00186 Roma", { countries: [italy] })?.state);
// → "RM"
RM

What it prints (run when this page was built)

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