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

spainconstant

Spain's module, for parseLocation and validateAddress: pass it in countries, and an address that ends with Spain, España or ES, or has a Spanish street's type and a postcode of five digits and a place on its last line, is read as Spanish; country: "ES" reads any address as one.

Import it

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

Definition

const spain: CountryModule = postcodeCountryModule(spanishSpec, (address) => formatCorreos(address))

Examples

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

console.log(parseLocation("Calle de Alcalá, 42, 28014 Madrid", { countries: [spain] })?.state);
// → "M"
M

What it prints (run when this page was built)

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