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 · /kr

formatKoreaPostfunction

Writes an address in South Korea as Korea Post asks. An address in Hangul is written from the province down on one line, with the floor and the unit after the road and the dong in brackets, and the postcode on a line of its own; one in Latin letters is written from the unit up, each of the unit, the road, the district and the province and postcode on its own line.

Import it

import { formatKoreaPost } from "@johnmorrisdotca/address-plus/kr";

Definition

function formatKoreaPost(address: ParsedAddress, options?: KoreaPostFormattingOptions): FormattedAddress

Parameters

NameTypeDescription
addressParsedAddress

The address as parseKoreanAddress returns it.

options (optional)KoreaPostFormattingOptions

Whether to add the country (see KoreaPostFormattingOptions).

Returns

FormattedAddress

The lines, the same on one line, the delivery line and the last line.

Examples

import { formatKoreaPost, parseKoreanAddress } from "@johnmorrisdotca/address-plus/kr";

const parsedAddress1 = parseKoreanAddress("서울 중구 세종대로 110 3층 (태평로1가) 04524");
if (!parsedAddress1) throw new Error("The example address did not parse.");
console.log(formatKoreaPost(parsedAddress1).lines);
// → ["서울특별시 중구 세종대로 110, 3층 (태평로1가)","04524"]
[ '서울특별시 중구 세종대로 110, 3층 (태평로1가)', '04524' ]

What it prints (run when this page was built)

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