Reference · Japanese addresses
ValidationErrortype
One finding of a validator: the field it is about, its code, a message, and how serious it is.
Import it
import type { ValidationError } from "@johnmorrisdotca/address-plus/jp";
Also exported from: @johnmorrisdotca/address-plus/au, @johnmorrisdotca/address-plus/gb, @johnmorrisdotca/address-plus/de, @johnmorrisdotca/address-plus/fr, @johnmorrisdotca/address-plus
Definition
interface ValidationError {
field: string;
code: string;
message: string;
severity: "error" | "warning" | "info";
}
Members
| Name | Type | Description |
|---|---|---|
field | string | |
code | string | |
message | string | |
severity | "error" | "warning" | "info" |
Examples
import { validateAddress } from "@johnmorrisdotca/address-plus";
import type { ValidationError } from "@johnmorrisdotca/address-plus/jp";
console.log(validateAddress("123 Main St, Seattle, NY 98101").warnings[0]);
// → {"field":"zip","code":"POSTAL_REGION_MISMATCH","message":"ZIP code 98101 belongs to WA, not NY","severity":"warning"}{
field: 'zip',
code: 'POSTAL_REGION_MISMATCH',
message: 'ZIP code 98101 belongs to WA, not NY',
severity: 'warning'
}What it prints (run when this page was built)