Skip to the content

address-plusアドレスプラス

Parse, validate, format and compare addresses locally, add country modules and mount an optional native form field.

address-plus extends the parse-address style with typed results, validation, formatting and country modules. About the name

Contents

Reference · German country module

parseGermanPostcodefunction

Takes a postcode apart: the Land it is in, from GeoNames' list (a postcode with places in two Länder takes the one most are in), and whether the list has it.

Import it

import { parseGermanPostcode } from "@johnmorrisdotca/address-plus/de";

Definition

function parseGermanPostcode(postcode: string): GermanPostcode | null

Parameters

NameTypeDescription
postcodestring

The postcode, with or without spaces.

Returns

GermanPostcode | null

The parts, or null when it is not five digits.

Examples

import { parseGermanPostcode } from "@johnmorrisdotca/address-plus/de";

console.log(parseGermanPostcode("80331"));
// → {"postcode":"80331","state":"BY","known":true}
{ postcode: '80331', state: 'BY', known: true }

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/address-plus 1.7.0.