本文へ移動

address-plusアドレスプラス

住所を端末の中で解析・確認・整形・比較し、国のモジュールや任意のフォームの入力欄を使えます。

address-plusは、parse-addressの使い方を広げ、型付きの結果、確認、書式、国のモジュールを加えます。 名前について(英語)

目次

リファレンス · /kr

parseKoreanAddress関数

リファレンスの説明と例は英語です。見出しと目次は日本語です。

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 { parseKoreanAddress } from "@johnmorrisdotca/address-plus/kr";

定義

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

引数

名前型説明
textstring

The address as one string.

options (省略可)ParseOptions

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

戻り値

ParsedAddress | null

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

例

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'
}

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/address-plus 1.10.2 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。