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
| Name | Type | Description |
|---|---|---|
text | string | 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)