parseDutchAddressfunction
Parses 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). NL-1015CJ is read as 1015 CJ.
Import it
import { parseDutchAddress } from "@johnmorrisdotca/address-plus/nl";
Definition
function parseDutchAddress(text: string, options?: ParseOptions): ParsedAddress | null
Parameters
| Name | Type | Description |
|---|---|---|
text | string | The address as one string; commas and line breaks both separate its parts. |
options (optional) | ParseOptions |
|
Returns
ParsedAddress | null
The parts found, with country NL, or null when the text is empty or holds nothing that makes it an
address.
Examples
import { parseDutchAddress } from "@johnmorrisdotca/address-plus/nl";
console.log(parseDutchAddress("Keizersgracht 123A, 1015 CJ Amsterdam"));
// → {"number":"123","numberExtension":"A","street":"Keizersgracht","city":"Amsterdam","zip":"1015 CJ","zipValid":true,"country":"NL"}{
number: '123',
numberExtension: 'A',
street: 'Keizersgracht',
city: 'Amsterdam',
zip: '1015 CJ',
zipValid: true,
country: 'NL'
}What it prints (run when this page was built)