Reference · Australian country module
FormattedAddresstype
A formatted address: its lines, and the same on one line.
Import it
import type { FormattedAddress } from "@johnmorrisdotca/address-plus/au";
Also exported from: @johnmorrisdotca/address-plus/gb, @johnmorrisdotca/address-plus/de, @johnmorrisdotca/address-plus/fr, @johnmorrisdotca/address-plus
Definition
interface FormattedAddress {
lines: string[];
singleLine: string;
deliveryLine?: string;
lastLine?: string;
country?: string;
format: "standard" | "usps" | "canada-post" | "international" | "australia-post" | "royal-mail" | "la-poste" | "deutsche-post";
}
Members
| Name | Type | Description |
|---|---|---|
lines | string[] | |
singleLine | string | |
deliveryLine (optional) | string | undefined | |
lastLine (optional) | string | undefined | |
country (optional) | string | undefined | |
format | "standard" | "usps" | "canada-post" | "international" | "australia-post" | "royal-mail" | "la-poste" | "deutsche-post" |
Examples
import { formatUSPS, parseLocation } from "@johnmorrisdotca/address-plus";
import type { FormattedAddress } from "@johnmorrisdotca/address-plus/au";
const parsedAddress1=parseLocation("123 Main St, Anytown, NY 12345");
if (!parsedAddress1) throw new Error("The example address did not parse.");
console.log(formatUSPS(parsedAddress1));
// → {"lines":["123 MAIN ST","ANYTOWN NY 12345"],"singleLine":"123 Main St, Anytown NY 12345","deliveryLine":"123 Main St","lastLine":"Anytown NY 12345","country":"US","format":"usps"}{
lines: [ '123 MAIN ST', 'ANYTOWN NY 12345' ],
singleLine: '123 Main St, Anytown NY 12345',
deliveryLine: '123 Main St',
lastLine: 'Anytown NY 12345',
country: 'US',
format: 'usps'
}What it prints (run when this page was built)