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

PosteItalianeFormattingOptionstype

Options for formatPosteItaliane.

Import it

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

Definition

interface PosteItalianeFormattingOptions {
    includeCountry?: boolean;
}

Members

NameTypeDescription
includeCountry (optional)boolean | undefined

Examples

import { formatPosteItaliane, parseItalianAddress } from "@johnmorrisdotca/address-plus/it";
import type { PosteItalianeFormattingOptions } from "@johnmorrisdotca/address-plus/it";

const options: PosteItalianeFormattingOptions = { includeCountry: true };
const parsedAddress1 = parseItalianAddress("Via del Corso 1, 00186 Roma RM");
if (!parsedAddress1) throw new Error("The example address did not parse.");
console.log(formatPosteItaliane(parsedAddress1, options).lines);
// → ["Via del Corso 1","00186 Roma RM","ITALIA"]
[ 'Via del Corso 1', '00186 Roma RM', 'ITALIA' ]

What it prints (run when this page was built)

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