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

AU_POSTCODE_RANGESconstant

The blocks of postcodes Australia Post allocates to each state and territory. A postcode outside every block is not Australian. A few postcodes near a border also serve towns across it (AU_CROSS_BORDER_POSTCODES), and the external territories have postcodes inside a state's block (AU_EXTERNAL_TERRITORY_POSTCODES).

Import it

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

Definition

const AU_POSTCODE_RANGES: readonly AustralianPostcodeRange[] = [
    { state: "NT", from: "0800", to: "0999", use: "delivery" },
    { state: "ACT", from: "0200", to: "0299", use: "delivery" },
    { state: "NSW", from: "1000", to: "1999", use: "po-box" },
    { state: "NSW", from: "2000", to: "2599", use: "delivery" },
    { state: "ACT", from: "2600", to: "2618", use: "delivery" },
    { state: "NSW", from: "2619", to: "2899", use: "delivery" },
    { state: "ACT", from: "2900", to: "2920", use: "delivery" },
    { state: "NSW", from: "2921", to: "2999", use: "delivery" },
    { state: "VIC", from: "3000", to: "3999", use: "delivery" },
    { state: "QLD", from: "4000", to: "4999", use: "delivery" },
    { state: "SA", from: "5000", to: "5999", use: "delivery" },
    { state: "WA", from: "6000", to: "6999", use: "delivery" },
    { state: "TAS", from: "7000", to: "7999", use: "delivery" },
    { state: "VIC", from: "8000", to: "8999", use: "po-box" },
    { state: "QLD", from: "9000", to: "9999", use: "po-box" },
]

Examples

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

console.log(AU_POSTCODE_RANGES.filter((range) => range.state === "ACT").map((range) => `${range.from}-${range.to}`));
// → ["0200-0299","2600-2618","2900-2920"]
[ '0200-0299', '2600-2618', '2900-2920' ]

What it prints (run when this page was built)

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