newZealandconstant
New Zealand's module, for parseLocation and validateAddress: pass it in countries, and an address that ends with
New Zealand, Aotearoa or NZ is read as from New Zealand; country: "NZ" reads any address as one.
Import it
import { newZealand } from "@johnmorrisdotca/address-plus/nz";
Definition
const newZealand: CountryModule = postcodeCountryModule(newZealandSpec, (address) => formatNZPost(address))
Examples
import { parseLocation } from "@johnmorrisdotca/address-plus";
import { newZealand } from "@johnmorrisdotca/address-plus/nz";
console.log(parseLocation("45 Dominion Road, Auckland 1024, New Zealand", { countries: [newZealand] })?.state);
// → "AUK"AUKWhat it prints (run when this page was built)