本文へ移動

address-plusアドレスプラス

住所を端末の中で解析・確認・整形・比較し、国のモジュールや任意のフォームの入力欄を使えます。

address-plusは、parse-addressの使い方を広げ、型付きの結果、確認、書式、国のモジュールを加えます。 名前について(英語)

目次

リファレンス · オーストラリアのモジュール

AU_POSTCODE_RANGES定数

リファレンスの説明と例は英語です。見出しと目次は日本語です。

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 { AU_POSTCODE_RANGES } from "@johnmorrisdotca/address-plus/au";

定義

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" },
]

例

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' ]

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/address-plus 1.7.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。