Reference · Australian country module
CountryValidationtype
What a country module's validator returns: the errors and the warnings it found.
Import it
import type { CountryValidation } from "@johnmorrisdotca/address-plus/au";
Also exported from: @johnmorrisdotca/address-plus/gb, @johnmorrisdotca/address-plus/de, @johnmorrisdotca/address-plus/fr, @johnmorrisdotca/address-plus
Definition
interface CountryValidation {
errors: ValidationError[];
warnings: ValidationError[];
}
Members
| Name | Type | Description |
|---|---|---|
errors | ValidationError[] | |
warnings | ValidationError[] |
Examples
import { parseAustralianAddress, validateAustralianAddress } from "@johnmorrisdotca/address-plus/au";
import type { CountryValidation } from "@johnmorrisdotca/address-plus/au";
const parsedAddress1=parseAustralianAddress("1 Main St, Sydney VIC 2000");
if (!parsedAddress1) throw new Error("The example address did not parse.");
console.log(validateAustralianAddress(parsedAddress1).warnings.map((one) => one.code));
// → ["POSTAL_REGION_MISMATCH"][ 'POSTAL_REGION_MISMATCH' ]What it prints (run when this page was built)