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

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"
AUK

What it prints (run when this page was built)

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