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

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

NameTypeDescription
firstParsedAddress

The first address, as parseDutchAddress returns it.

secondParsedAddress

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);
// → 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.