formatJapanese関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Writes a Japanese address in Japanese order, as an envelope is addressed: 〒100-0005, then 東京都千代田区丸の内1-2-3, then
サンプルビル5階501号室. The prefecture and municipality are always in kanji, from the tables. A town or building parsed
from romaji keeps its romaji, set off by spaces so the scripts do not run together. Kyoto's street directions are
written before the town.
インポート
import { formatJapanese } from "@johnmorrisdotca/address-plus/jp";
ほかのエクスポート元: @johnmorrisdotca/address-plus
定義
function formatJapanese(address: ParsedAddress, options?: JapaneseFormattingOptions): string
引数
| 名前 | 型 | 説明 |
|---|---|---|
address | ParsedAddress | The address, as |
options (省略可) | JapaneseFormattingOptions | The block's style ( |
戻り値
string
The address as text, its lines joined with newlines unless options.multiline is false; an empty string
when the address has none of the parts.
例
import { formatJapanese } from "@johnmorrisdotca/address-plus/jp";
import { parseLocation } from "@johnmorrisdotca/address-plus";
const parsedAddress1=parseLocation("〒100-0005 東京都千代田区丸の内1-2-3");
if (!parsedAddress1) throw new Error("The example address did not parse.");
console.log(formatJapanese(parsedAddress1, { blockStyle: "markers", multiline: false }));
// → "〒100-0005 東京都千代田区丸の内1丁目2番3号"〒100-0005 東京都千代田区丸の内1丁目2番3号出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。