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

import { … } from "@johnmorrisdotca/address-plus/nl";

5.4 kB minified and gzipped, with everything it imports (measured with esbuild)

Exports

NameKindWhat it is
compareDutchAddressesfunctionCompares two addresses in the Netherlands field by field: the street, the house number and its addition, the place and the postcode.
CountryComparisontypeWhat a country module's comparer returns: whether the two addresses are the same delivery point, and every field that differs once both are in the same form (letter case, punctuation, a street type written out or abbreviated).
CountryDifferencetypeOne way two addresses differ, as a country module's comparer reports it: the field, and its value in each address after both were put in the same form.
CountryModuletypeA country's address module: its codes, how to tell its addresses apart, and its parser, validator, formatter and comparer.
CountryValidationtypeWhat a country module's validator returns: the errors and the warnings it found.
formatPostNLfunctionWrites an address in the Netherlands as PostNL asks: who it is care of (t.a.v.), the street with its house number and addition, or the Postbus, then the postcode (four digits, a space, two capitals) and the place, each on its own line.
FormattedAddresstypeA formatted address: its lines, and the same on one line.
isKnownDutchPostcodefunctionWhether CBS's list of four-digit postcode areas for the Netherlands has the digits of a postcode (4,070 areas, from the statistics for 2023).
isValidDutchPostcodefunctionWhether a postcode follows PostNL's shape: four digits (the first not nought) and two letters (not beginning SA, SD or SS), with or without the space between.
looksDutchfunctionWhether an address is surely Dutch, with no hint: it ends with the Netherlands, Nederland or NL, or its last line is a postcode of four digits and two letters (1015 CJ, never beginning SA, SD or SS) and a place.
netherlandsconstantThe Netherlands' module, for parseLocation and validateAddress: pass it in countries, and an address that ends with the Netherlands, Nederland or NL, or has a postcode of four digits and two letters and a place on its last line, is read as Dutch; country: "NL" reads any address as one.
ParsedAddresstypeWhat parseLocation returns: every part it found, each absent when the address has none.
parseDutchAddressfunctionParses an address in the Netherlands into the parts PostNL lays out: who it is care of (careOf), a building or name above the street (building), the street in street, the house number in number with its addition in numberExtension (the A of 123A, the 2 of 123-2, bis), a Postbus (secUnitType and secUnitNum), the place in city and the postcode in zip in its canonical form (1015 CJ).
parseDutchPostcodefunctionTakes a postcode apart: its canonical form (1015 CJ) and whether CBS's list has its digits.
ParseOptionstypeOptions for every parser: the country, strict postal codes, snake_case keys and the rest.
PostcodeLookuptypeA postcode taken apart: its canonical form, the region it is in (when the country's table has regions), and whether the country's list has it.
PostcodeRegiontypeA region a postcode can be in, as a country's table holds it: its code, its ISO 3166-2 code, and its name in English and in Japanese (from kuni, which takes them from Unicode CLDR and Wikidata).
PostNLFormattingOptionstypeOptions for formatPostNL.
validateDutchAddressfunctionChecks an address in the Netherlands: the postcode is four digits and two letters and CBS's list of postcode areas has the digits, and the place and the house number are given.
ValidationErrortypeOne finding of a validator: the field it is about, its code, a message, and how serious it is.
ValidationOptionstypeOptions for the validators: which parts an address must have, which kinds are allowed, and whether a postal code that does not match its region is an error.

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