compareDutchAddressesfunction
Compares two addresses in the Netherlands field by field: the street, the house number and its addition, the place and the
postcode. Letter case, accents, straat and str., and the postcode's space are not differences.
Import it
import { compareDutchAddresses } from "@johnmorrisdotca/address-plus/nl";
Definition
function compareDutchAddresses(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 { compareDutchAddresses, parseDutchAddress } from "@johnmorrisdotca/address-plus/nl";
const parsedAddress1 = parseDutchAddress("Keizersgracht 123, 1015 CJ Amsterdam");
if (!parsedAddress1) throw new Error("The example address did not parse.");
const parsedAddress2 = parseDutchAddress("KEIZERSGRACHT 123, 1015CJ AMSTERDAM");
if (!parsedAddress2) throw new Error("The example address did not parse.");
console.log(compareDutchAddresses(parsedAddress1, parsedAddress2).isSame);
// → truetrueWhat it prints (run when this page was built)