本文へ移動

address-plusアドレスプラス

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

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

目次

リファレンス · /it

parseItalianAddress関数

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

Parses an address in Italy into the parts Poste Italiane lays out: who it is care of (careOf), a building (building: Palazzo Rossi), the street as written with its type (street: Via del Corso, V.le Monza), its civic number in number (12, 12-14, or SNC for senza numero civico) with its letter or sub-number in numberExtension (the A of 12/A, bis), the staircase (staircase), the floor (floorType Piano and floor), the flat (secUnitType Interno and secUnitNum), a Casella Postale, the frazione in locality, the place in city, the postcode (CAP) in zip and the province's sigla in state (RM), as written or from the postcode.

インポート

import { parseItalianAddress } from "@johnmorrisdotca/address-plus/it";

定義

function parseItalianAddress(text: string, options?: ParseOptions): ParsedAddress | null

引数

名前型説明
textstring

The address as one string; commas and line breaks both separate its parts.

options (省略可)ParseOptions

useSnakeCase gives snake_case keys; the other options are not used.

戻り値

ParsedAddress | null

The parts found, with country IT, or null when the text is empty or holds nothing that makes it an address.

例

import { parseItalianAddress } from "@johnmorrisdotca/address-plus/it";

console.log(parseItalianAddress("Via del Corso, 12/A, 00186 Roma RM"));
// → {"number":"12","numberExtension":"A","street":"Via del Corso","city":"Roma","state":"RM","zip":"00186","zipValid":true,"country":"IT"}
{
  number: '12',
  numberExtension: 'A',
  street: 'Via del Corso',
  city: 'Roma',
  state: 'RM',
  zip: '00186',
  zipValid: true,
  country: 'IT'
}

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

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

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