リファレンス
英国のモジュール
import { … } from "@johnmorrisdotca/address-plus/gb";
最小化と gzip 圧縮をしたサイズは 8.7 kB(読み込むものをすべて含み、esbuild で計測)
リファレンスの説明と例は英語です。見出しと目次は日本語です。
エクスポート
| 名前 | 種類 | 概要 |
|---|---|---|
compareUKAddresses | 関数 | Compares two addresses in the United Kingdom field by field: the flat, the building, the number, the thoroughfare, the post town and the 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. |
findUKNation | 関数 | Finds a nation of the United Kingdom by its code (SCT, GB-SCT) or its name in English or Japanese. |
formatRoyalMail | 関数 | Writes an address in the United Kingdom as Royal Mail asks: the flat or part of the building, the floor, the building's name, the number with the dependent thoroughfare or the thoroughfare, the localities, then the post town and the postcode in capitals, each on its own line. |
FormattedAddress | 型 | A formatted address: its lines, and the same on one line. |
GB_DISTRICT_NATIONS | 定数 | The postcode districts not wholly in the nation of their area, each with the nations its postcodes lie in, the one with most of them first: the districts that cross the borders of Wales and of Scotland, and those wholly across one (CH5 to CH8 are in Wales, though most of the CH area is in England). |
GB_NATIONS | 定数 | The four nations of the United Kingdom, in order of their codes, each with its ISO 3166-2 code and its name in English and in Japanese. |
GB_POSTCODE_AREAS | 定数 | Every postcode area Royal Mail uses: the 121 of the United Kingdom, the three Crown Dependencies (GY, IM, JE), and the two that are not places, BF (the British Forces Post Office) and BX (addresses kept for organisations wherever they are). |
GB_POSTCODE_DISTRICTS | 定数 | Every postcode district in Great Britain, by area: the numbered districts as runs, then those with a letter. |
GB_THOROUGHFARE_DESCRIPTORS | 定数 | The thoroughfare descriptors the parser takes off the end of a street's name and reports, in full, as type (High Street is street High, type Street), with the abbreviations it reads for each. |
getNationFromUKPostcode | 関数 | The nation of the United Kingdom a postcode delivers to, by its area, or by its district where the district crosses the border with Wales or with Scotland (the nation most of its postcodes are in). |
getNationsForUKPostcode | 関数 | Every nation a postcode's district delivers to: one for most, two for the districts along the borders of Wales and of Scotland (from Code-Point Open), the nation with most of the district's postcodes first. |
isValidUKPostcode | 関数 | Whether a postcode follows Royal Mail's grammar: one of the six shapes (M2 5BQ, M34 4AB, CR0 2YR, DN16 9AA, W1A 4ZZ, EC1A 1HQ) with the letters each place allows, or GIR 0AA. |
looksBritish | 関数 | Whether an address is surely British, with no hint: it ends with the United Kingdom or one of its nations (or Jersey, Guernsey or the Isle of Man), or it holds a full postcode in Royal Mail's grammar whose area Royal Mail uses, or BFPO and a number. |
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. |
parseUKAddress | 関数 | Parses an address in the United Kingdom (or Jersey, Guernsey and the Isle of Man, which share Royal Mail's postcodes) into the parts of Royal Mail's Postcode Address File: a flat or unit (secUnitType, secUnitNum) or a named part of a building (subBuilding), a floor, the building's name, the number, a dependent thoroughfare, the thoroughfare (its name in street, its descriptor in full in type), the dependent localities, the post town in city, a county, and the postcode in zip with the nation it delivers to. |
parseUKPostcode | 関数 | Takes a postcode apart: outward code, inward code, area, district and sector, and says where it delivers: the country (GB, or JE, GY or IM for the Crown Dependencies) and, in the United Kingdom, the nation. |
RoyalMailFormattingOptions | 型 | Options for formatRoyalMail. |
UKAddressFields | 型 | The fields an address in the United Kingdom fills beside the shared ones. |
UKNation | 型 | A nation of the United Kingdom in the tables: its code, its ISO 3166-2 code, and its name in English and in Japanese (from kuni, which takes them from Unicode CLDR and Wikidata). |
UKNationCode | 型 | The code of one of the four nations of the United Kingdom, as ISO 3166-2:GB writes it after GB-. |
UKPostcode | 型 | A postcode taken apart: the outward code (area and district) and the inward code (sector and unit), and where it delivers. |
UKPostcodeArea | 型 | A postcode area: the town Royal Mail names it for, the country it delivers to (GB, or JE, GY and IM for the Crown Dependencies), and for the United Kingdom the nation, absent for an area that is not a place (BF, BX). |
unitedKingdom | 定数 | The United Kingdom's module, for parseLocation and validateAddress: pass it in countries, and an address with a British postcode (or ending with the United Kingdom or a nation) is read as British; country: "GB" reads any address as one. |
validateUKAddress | 関数 | Checks an address in the United Kingdom against Royal Mail's postcode grammar and the tables: the postcode is well formed, Royal Mail uses its area, and in Great Britain Code-Point Open lists its district. |
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. |
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。