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

getStateFromGermanPostcodefunction

The Land a postcode is in, by its code: BY for 80331, BE for 10115.

Import it

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

Definition

function getStateFromGermanPostcode(postcode: string): GermanStateCode | undefined

Parameters

NameTypeDescription
postcodestring

The postcode.

Returns

GermanStateCode | undefined

The Land's code; undefined for a postcode GeoNames' list does not have, or text that is not a postcode.

Examples

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

console.log(["80331", "10115", "20095", "00000"].map(getStateFromGermanPostcode));
// → ["BY","BE","HH",null]
[ 'BY', 'BE', 'HH', undefined ]

What it prints (run when this page was built)

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