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 · /es

getProvinceFromSpanishPostcodefunction

The province a postcode is in, as its ISO 3166-2 code without ES-: the province its first two digits name.

Import it

import { getProvinceFromSpanishPostcode } from "@johnmorrisdotca/address-plus/es";

Definition

function getProvinceFromSpanishPostcode(postcode: string): string | undefined

Parameters

NameTypeDescription
postcodestring

The postcode.

Returns

string | undefined

The province's code (M for Madrid), or undefined when the postcode has not the shape.

Examples

import { getProvinceFromSpanishPostcode } from "@johnmorrisdotca/address-plus/es";

console.log(["28014", "08001", "41001", "35001", "1234"].map(getProvinceFromSpanishPostcode));
// → ["M","B","SE","GC",null]
[ 'M', 'B', 'SE', 'GC', undefined ]

What it prints (run when this page was built)

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