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
| Name | Type | Description |
|---|---|---|
first | ParsedAddress | The first address, as |
second | ParsedAddress | 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);
// → truetrueWhat it prints (run when this page was built)