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

compareItalianAddressesfunction

Compares two addresses in Italy field by field: the street, the civic number, the staircase, the flat, the place and the postcode. Letter case, accents, Via and V. and Viale and V.le, and an article after the type are not differences.

Import it

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

Definition

function compareItalianAddresses(first: ParsedAddress, second: ParsedAddress): CountryComparison

Parameters

NameTypeDescription
firstParsedAddress

The first address, as parseItalianAddress returns it.

secondParsedAddress

The second address.

Returns

CountryComparison

Whether they are the same delivery point, and each field that differs.

Examples

import { compareItalianAddresses, parseItalianAddress } from "@johnmorrisdotca/address-plus/it";

const parsedAddress1 = parseItalianAddress("Via del Corso 1, 00186 Roma");
if (!parsedAddress1) throw new Error("The example address did not parse.");
const parsedAddress2 = parseItalianAddress("V. del Corso, 1, 00186 ROMA");
if (!parsedAddress2) throw new Error("The example address did not parse.");
console.log(compareItalianAddresses(parsedAddress1, parsedAddress2).isSame);
// → true
true

What it prints (run when this page was built)

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