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

parseKoreanAddressfunction

Parses an address in South Korea, written in Hangul from the province down (서울특별시 중구 세종대로 110 (태평로1가)) or in Latin letters from the number up (110 Sejong-daero, Jung-gu, Seoul 04524). The fields mean the same in both: the province or metropolitan city's code in state (11 for Seoul), the district in city (중구, or 수원시 영통구 for a district of a city), the road as written in street (세종대로, Sejong-daero), the building number on the road in number (110), the dong, ri or eup in locality, a building's name or its block in building, the floor (floorType 층 or Floor, and floor), the unit (secUnitType 호 or Unit, and secUnitNum) and the five-digit postcode in zip, which may stand at either end or in brackets.

Import it

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

Definition

function parseKoreanAddress(text: string, options?: ParseOptions): ParsedAddress | null

Parameters

NameTypeDescription
textstring

The address as one string.

options (optional)ParseOptions

useSnakeCase gives snake_case keys; the other options are not used.

Returns

ParsedAddress | null

The parts found, with country KR, or null when the text is empty or holds nothing that makes it an address.

Examples

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

console.log(parseKoreanAddress("(04524) 서울특별시 중구 세종대로 110, 3층 (태평로1가)"));
// → {"state":"11","city":"중구","street":"세종대로","number":"110","locality":"태평로1가","floorType":"층","floor":"3","zip":"04524","zipValid":true,"country":"KR"}
{
  state: '11',
  city: '중구',
  street: '세종대로',
  number: '110',
  locality: '태평로1가',
  floorType: '층',
  floor: '3',
  zip: '04524',
  zipValid: true,
  country: 'KR'
}

What it prints (run when this page was built)

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