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
| Name | Type | Description |
|---|---|---|
first | ParsedAddress | The first address, as |
second | ParsedAddress | 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);
// → truetrueWhat it prints (run when this page was built)