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

southKoreaconstant

South Korea's module, for parseLocation and validateAddress: pass it in countries, and an address that ends with South Korea, Korea or 대한민국, or is written in Hangul with a province's name or a road and its number, is read as Korean; country: "KR" reads any address as one.

Import it

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

Definition

const southKorea: CountryModule = {
    ...postcodeCountryModule(koreanSpec, (address) => formatKoreaPost(address)),
    parse: (text, options) => parseKoreanText(text, options),
}

Members

NameTypeDescription
codestring
codesreadonly string[]
namestring
detect(address: string): boolean
parse(address: string, options?: ParseOptions): ParsedAddress | null
validate(address: ParsedAddress, options?: ValidationOptions): CountryValidation
format(address: ParsedAddress): FormattedAddress
compare(first: ParsedAddress, second: ParsedAddress): CountryComparison

Examples

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

console.log(parseLocation("서울특별시 중구 세종대로 110", { countries: [southKorea] })?.number);
// → "110"
110

What it prints (run when this page was built)

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