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 · Australian country module

getStatesForAustralianPostcodefunction

Every state or territory a postcode serves: its block's state, and for a postcode that crosses a border, the states across it too, the one with most of the postcode's area first.

Import it

import { getStatesForAustralianPostcode } from "@johnmorrisdotca/address-plus/au";

Definition

function getStatesForAustralianPostcode(postcode: string): AustralianStateCode[]

Parameters

NameTypeDescription
postcodestring

Four digits.

Returns

AustralianStateCode[]

The states' codes; an empty array when the postcode is not in any block.

Examples

import { getStatesForAustralianPostcode } from "@johnmorrisdotca/address-plus/au";

console.log(getStatesForAustralianPostcode("0872"));
// → ["NT","SA","WA"]
[ 'NT', 'SA', 'WA' ]

What it prints (run when this page was built)

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