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

compareKoreanAddressesfunction

Compares two addresses in South Korea field by field: the province, the district, the road and its number, the dong, the floor, the unit and the postcode. Spaces and hyphens in a road's name and letter case in Latin letters are not differences.

Import it

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

Definition

function compareKoreanAddresses(first: ParsedAddress, second: ParsedAddress): CountryComparison

Parameters

NameTypeDescription
firstParsedAddress

The first address, as parseKoreanAddress returns it.

secondParsedAddress

The second address.

Returns

CountryComparison

Whether they are the same delivery point, and each field that differs.

Examples

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

const parsedAddress1 = parseKoreanAddress("110 Sejong-daero, Jung-gu, Seoul 04524");
if (!parsedAddress1) throw new Error("The example address did not parse.");
const parsedAddress2 = parseKoreanAddress("110 SEJONGDAERO, JUNG-GU, SEOUL 04524");
if (!parsedAddress2) throw new Error("The example address did not parse.");
console.log(compareKoreanAddresses(parsedAddress1, parsedAddress2).isSame);
// → true
true

What it prints (run when this page was built)

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