Reference · Australian country module
looksAustralianfunction
Whether an address is surely Australian, with no hint: it ends with Australia, or with a state and an Australian
postcode (NSW 2150, Victoria 3000, VIC 2000, whose postcode is Sydney's). WA needs one of Western
Australia's postcodes (WA 6000), since WA 9810 is a Washington ZIP code cut short. A postcode alone is not
enough: four digits end addresses in many countries.
Import it
import { looksAustralian } from "@johnmorrisdotca/address-plus/au";
Definition
function looksAustralian(text: string): boolean
Parameters
| Name | Type | Description |
|---|---|---|
text | string | The address as one string. |
Returns
boolean
true when the address is Australian beyond doubt, false otherwise.
Examples
import { looksAustralian } from "@johnmorrisdotca/address-plus/au";
console.log([looksAustralian("12 Smith St, Parramatta NSW 2150"), looksAustralian("123 Main St, Seattle, WA 9810")]);
// → [true,false][ true, false ]What it prints (run when this page was built)