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
| Name | Type | Description |
|---|---|---|
postcode | string | 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)