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 · Japanese addresses

JapaneseValidationtype

What validateJapaneseAddress returns: the errors and the warnings found.

Import it

import type { JapaneseValidation } from "@johnmorrisdotca/address-plus/jp";

Also exported from: @johnmorrisdotca/address-plus

Definition

interface JapaneseValidation {
    errors: ValidationError[];
    warnings: ValidationError[];
}

Members

NameTypeDescription
errorsValidationError[]
warningsValidationError[]

Examples

import { validateJapaneseAddress } from "@johnmorrisdotca/address-plus/jp";
import { parseLocation } from "@johnmorrisdotca/address-plus";
import type { JapaneseValidation } from "@johnmorrisdotca/address-plus/jp";

const parsedAddress1=parseLocation("東京都大阪市北区梅田1-1");
if (!parsedAddress1) throw new Error("The example address did not parse.");
console.log(validateJapaneseAddress(parsedAddress1).warnings.map((one) => one.code));
// → ["MUNICIPALITY_PREFECTURE_MISMATCH"]
[ 'MUNICIPALITY_PREFECTURE_MISMATCH' ]

What it prints (run when this page was built)

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