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

brazilconstant

Brazil's module, for parseLocation and validateAddress: pass it in countries, and an address that ends with Brazil, Brasil or BR, or with a CEP written with its hyphen in the range of a state after CEP or a state's code, is read as Brazilian; country: "BR" reads any address as one.

Import it

import { brazil } from "@johnmorrisdotca/address-plus/br";

Definition

const brazil: CountryModule = postcodeCountryModule(brazilianSpec, (address) => formatBrazilianPost(address))

Examples

import { parseLocation } from "@johnmorrisdotca/address-plus";
import { brazil } from "@johnmorrisdotca/address-plus/br";

console.log(parseLocation("Rua Augusta, 100, São Paulo - SP, 01305-000", { countries: [brazil] })?.state);
// → "SP"
SP

What it prints (run when this page was built)

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