Reference · Japanese addresses
formatJapaneseEnglishfunction
Writes a Japanese address in English order, as a form from abroad expects: building, room, block, town, municipality, prefecture, postal code, Japan. The prefecture and municipality are always romaji, from the tables; the town and building are written as they were parsed, since the tables hold no romaji for towns.
Import it
import { formatJapaneseEnglish } from "@johnmorrisdotca/address-plus/jp";
Also exported from: @johnmorrisdotca/address-plus
Definition
function formatJapaneseEnglish(address: ParsedAddress, options?: JapaneseEnglishFormattingOptions): string
Parameters
| Name | Type | Description |
|---|---|---|
address | ParsedAddress | The address, as |
options (optional) | JapaneseEnglishFormattingOptions | Whether to end with the postal code and with Japan (see |
Returns
string
The address as one line, its parts joined by commas.
Examples
import { formatJapaneseEnglish } from "@johnmorrisdotca/address-plus/jp";
import { parseLocation } from "@johnmorrisdotca/address-plus";
const parsedAddress1=parseLocation("1-2-3 Marunouchi, Chiyoda-ku, Tokyo 100-0005");
if (!parsedAddress1) throw new Error("The example address did not parse.");
console.log(formatJapaneseEnglish(parsedAddress1));
// → "1-2-3 Marunouchi, Chiyoda-ku, Tokyo 100-0005, Japan"1-2-3 Marunouchi, Chiyoda-ku, Tokyo 100-0005, JapanWhat it prints (run when this page was built)