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

JapaneseEnglishFormattingOptionstype

Options for formatJapaneseEnglish.

Import it

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

Also exported from: @johnmorrisdotca/address-plus

Definition

interface JapaneseEnglishFormattingOptions {
    includeCountry?: boolean;
    includePostalCode?: boolean;
}

Members

NameTypeDescription
includeCountry (optional)boolean | undefined
includePostalCode (optional)boolean | undefined

Examples

import { formatJapaneseEnglish } from "@johnmorrisdotca/address-plus/jp";
import { parseLocation } from "@johnmorrisdotca/address-plus";
import type { JapaneseEnglishFormattingOptions } from "@johnmorrisdotca/address-plus/jp";

const parsedAddress1=parseLocation("〒100-0005 東京都千代田区丸の内1-2-3");
if (!parsedAddress1) throw new Error("The example address did not parse.");
console.log(formatJapaneseEnglish(parsedAddress1, { includeCountry: false }));
// → "1-2-3 丸の内, Chiyoda-ku, Tokyo 100-0005"
1-2-3 丸の内, Chiyoda-ku, Tokyo 100-0005

What it prints (run when this page was built)

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