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

isValidSpanishPostcodefunction

Whether a postcode follows Correos' shape: five digits, the first two a province's number (01 to 52). Whether it is in use is a different question; isKnownSpanishPostcode asks it, and the validator checks both.

Import it

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

Definition

function isValidSpanishPostcode(postcode: string): boolean

Parameters

NameTypeDescription
postcodestring

The postcode.

Returns

boolean

true when it has the shape.

Examples

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

console.log(["28014", "01001", "52080", "00100", "53000", "2801"].map(isValidSpanishPostcode));
// → [true,true,true,false,false,false]
[ true, true, true, false, false, false ]

What it prints (run when this page was built)

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