Reference · German country module
formatDeutschePostfunction
Writes an address in Germany as Deutsche Post asks: who it is care of (c/o), the part of the building, the flat and
the floor, the street and its house number, then the postcode and the place, each on its own line, with no punctuation
at the end of a line. A Postfach is written with its number in pairs (Postfach 12 34 56) and a Packstation with its
number.
Import it
import { formatDeutschePost } from "@johnmorrisdotca/address-plus/de";
Definition
function formatDeutschePost(address: ParsedAddress, options?: DeutschePostFormattingOptions): FormattedAddress
Parameters
| Name | Type | Description |
|---|---|---|
address | ParsedAddress | The address as |
options (optional) | DeutschePostFormattingOptions | Whether to add the country (see |
Returns
FormattedAddress
The lines, the same on one line, the delivery line (the street and its number) and the last line.
Examples
import { formatDeutschePost, parseGermanAddress } from "@johnmorrisdotca/address-plus/de";
const parsedAddress1=parseGermanAddress("Hinterhaus, 2. OG, Kastanienallee 4 b, 10435 Berlin");
if (!parsedAddress1) throw new Error("The example address did not parse.");
console.log(formatDeutschePost(parsedAddress1).lines);
// → ["Hinterhaus","2. OG","Kastanienallee 4B","10435 Berlin"][ 'Hinterhaus', '2. OG', 'Kastanienallee 4B', '10435 Berlin' ]What it prints (run when this page was built)