parseItalianAddressfunction
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 it
import { parseItalianAddress } from "@johnmorrisdotca/address-plus/it";
Definition
function parseItalianAddress(text: string, options?: ParseOptions): ParsedAddress | null
Parameters
| Name | Type | Description |
|---|---|---|
text | string | The address as one string; commas and line breaks both separate its parts. |
options (optional) | ParseOptions |
|
Returns
ParsedAddress | null
The parts found, with country IT, or null when the text is empty or holds nothing that makes it an
address.
Examples
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'
}What it prints (run when this page was built)