parseSpanishAddress関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Parses an address in Spain into the parts Correos lays out: who it is care of (careOf), the street as written with
its type (street: Calle de Alcalá, C/ Mayor), its number in number (42, 12-14, S/N), the floor and the door
(floorType Piso and floor, secUnitType Puerta and secUnitNum: 3º B), the staircase and the entrance, an
Apartado de Correos, the place in city, the province in county when it is written in brackets, the postcode in zip
and the province's code in state (M for Madrid), from the postcode. The number may follow the street after a
comma or not.
インポート
import { parseSpanishAddress } from "@johnmorrisdotca/address-plus/es";
定義
function parseSpanishAddress(text: string, options?: ParseOptions): ParsedAddress | null
引数
| 名前 | 型 | 説明 |
|---|---|---|
text | string | The address as one string; commas and line breaks both separate its parts. |
options (省略可) | ParseOptions |
|
戻り値
ParsedAddress | null
The parts found, with country ES, or null when the text is empty or holds nothing that makes it an
address.
例
import { parseSpanishAddress } from "@johnmorrisdotca/address-plus/es";
console.log(parseSpanishAddress("Calle de Alcalá, 42, 3º B, 28014 Madrid"));
// → {"secUnitType":"Puerta","secUnitNum":"B","floorType":"Piso","floor":"3","number":"42","street":"Calle de Alcalá","city":"Madrid","state":"M","zip":"28014","zipValid":true,"country":"ES"}{
secUnitType: 'Puerta',
secUnitNum: 'B',
floorType: 'Piso',
floor: '3',
number: '42',
street: 'Calle de Alcalá',
city: 'Madrid',
state: 'M',
zip: '28014',
zipValid: true,
country: 'ES'
}出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。