本文へ移動

address-plusアドレスプラス

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

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

目次

リファレンス

オーストラリアのモジュール

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

最小化と gzip 圧縮をしたサイズは 7.2 kB(読み込むものをすべて含み、esbuild で計測)

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

エクスポート

名前種類概要
AU_CROSS_BORDER_POSTCODES定数The postcodes whose area lies in more than one state or territory, each with the states it lies in, the one with most of it first.
AU_EXTERNAL_TERRITORY_POSTCODES定数The postcodes the Australian Bureau of Statistics places, wholly or partly, in the Other Territories: Jervis Bay, Norfolk Island, Christmas Island and the Cocos (Keeling) Islands.
AU_POSTCODE_RANGES定数The blocks of postcodes Australia Post allocates to each state and territory.
AU_STATES定数The six states and two territories of Australia, in order of their codes, each with Australia Post's code, the ISO 3166-2 code and its name in English and in Japanese.
AU_STREET_TYPES定数Australia's street types: each AS4590 abbreviation, in proper case as the parser reports it, with the word it stands for.
australia定数Australia's module, for parseLocation and validateAddress: pass it in countries, and an address that ends with a state and its postcode (or Australia) is read as Australian; country: "AU" reads any address as one.
AustralianAddressFields型The fields an Australian address fills beside the shared ones.
AustralianPostcodeRange型One block of postcodes Australia Post allocates to a state or territory: every postcode from from to to, inclusive, written as four digits.
AustralianState型An Australian state or territory in the tables: Australia Post's code, the ISO 3166-2 code, and its name in English and in Japanese (from kuni, which takes them from Unicode CLDR and Wikidata).
AustralianStateCode型The code of an Australian state or territory, as Australia Post writes it on the last line of an address.
AustraliaPostFormattingOptions型Options for formatAustraliaPost.
compareAustralianAddresses関数Compares two Australian addresses field by field: the unit, level, lot, number, street, suburb, state and postcode.
CountryComparison型What a country module's comparer returns: whether the two addresses are the same delivery point, and every field that differs once both are in the same form (letter case, punctuation, a street type written out or abbreviated).
CountryDifference型One way two addresses differ, as a country module's comparer reports it: the field, and its value in each address after both were put in the same form.
CountryModule型A country's address module: its codes, how to tell its addresses apart, and its parser, validator, formatter and comparer.
CountryValidation型What a country module's validator returns: the errors and the warnings it found.
expandAustralianStreetType関数The word an AS4590 street type stands for: Pde is Parade.
findAustralianState関数Finds an Australian state or territory by its code (VIC, AU-VIC, Vic.) or its name in English or Japanese (Victoria, ビクトリア州), in any letter case.
formatAustraliaPost関数Writes an Australian address as Australia Post asks: the building's name, then the delivery line (unit and level before the number, the street type abbreviated), then the suburb, state and postcode, both in capitals with no punctuation.
FormattedAddress型A formatted address: its lines, and the same on one line.
getPostcodeRangesForAustralianState関数The blocks of postcodes Australia Post allocates to a state or territory.
getStateFromAustralianPostcode関数The state or territory whose block of postcodes a postcode is in.
getStatesForAustralianPostcode関数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.
looksAustralian関数Whether an address is surely Australian, with no hint: it ends with Australia, or with a state and an Australian postcode (NSW 2150, Victoria 3000, VIC 2000, whose postcode is Sydney's).
parseAustralianAddress関数Parses an Australian address into its parts, as Australia Post lays one out: the delivery line, then the suburb or town, the state and the postcode.
ParsedAddress型What parseLocation returns: every part it found, each absent when the address has none.
ParseOptions型Options for every parser: the country, strict postal codes, snake_case keys and the rest.
validateAustralianAddress関数Checks an Australian address against Australia Post's blocks of postcodes: the postcode is four digits, some state's block holds it, and it is the state named, or one it serves across a border (from the ABS's Postal Areas).
ValidationError型One finding of a validator: the field it is about, its code, a message, and how serious it is.
ValidationOptions型Options for the validators: which parts an address must have, which kinds are allowed, and whether a postal code that does not match its region is an error.

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

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