getRegionFromNewZealandPostcodefunction
The region a postcode is in, by its ISO 3166-2 code without NZ- (AUK for Auckland): the one most of GeoNames' places
for the postcode are in.
Import it
import { getRegionFromNewZealandPostcode } from "@johnmorrisdotca/address-plus/nz";
Definition
function getRegionFromNewZealandPostcode(postcode: string): string | undefined
Parameters
| Name | Type | Description |
|---|---|---|
postcode | string | The postcode. |
Returns
string | undefined
The region's code, or undefined when the list does not have the postcode or gives it no region.
Examples
import { getRegionFromNewZealandPostcode } from "@johnmorrisdotca/address-plus/nz";
console.log(["1010", "6011", "8011", "9016", "9999"].map(getRegionFromNewZealandPostcode));
// → ["AUK","WGN","CAN","OTA",null][ 'AUK', 'WGN', 'CAN', 'OTA', undefined ]What it prints (run when this page was built)