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

looksBrazilianfunction

Whether an address is surely Brazilian, with no hint: it ends with Brazil, Brasil or BR, or with a CEP written with its hyphen (01310-200, five digits, a hyphen and three) in the range of a state, after the word CEP or a Brazilian state's code (SP). A bare number of that shape claims nothing: a US ZIP+4 has four digits after the hyphen and Portugal's has three before it, but other places may write five and three.

Import it

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

Definition

function looksBrazilian(text: string): boolean

Parameters

NameTypeDescription
textstring

The address as one string.

Returns

boolean

true when the address is Brazilian beyond doubt, false otherwise.

Examples

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

console.log([looksBrazilian("Rua Augusta, 100, São Paulo - SP, 01305-000"), looksBrazilian("123 Main St, Seattle, WA 98101-1234")]);
// → [true,false]
[ true, false ]

What it prints (run when this page was built)

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