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

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

7.9 kB minified and gzipped, with everything it imports (measured with esbuild)

Exports

NameKindWhat it is
compareKoreanAddressesfunctionCompares 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.
CountryComparisontypeWhat a country module's comparer returns: whether the two addresses are the same delivery point, and every field that differs once both are in the same form (letter case, punctuation, a street type written out or abbreviated).
CountryDifferencetypeOne way two addresses differ, as a country module's comparer reports it: the field, and its value in each address after both were put in the same form.
CountryModuletypeA country's address module: its codes, how to tell its addresses apart, and its parser, validator, formatter and comparer.
CountryValidationtypeWhat a country module's validator returns: the errors and the warnings it found.
findKoreanProvincefunctionFinds a province or metropolitan city of South Korea by its code (11, KR-11), its name in English (Seoul, Gyeonggi-do) or its name in Korean (서울특별시, 서울), ignoring letter case, spaces and hyphens.
formatKoreaPostfunctionWrites an address in South Korea as Korea Post asks.
FormattedAddresstypeA formatted address: its lines, and the same on one line.
getProvinceFromKoreanPostcodefunctionThe province or metropolitan city a postcode is in, by its ISO 3166-2 code without KR- (11 for Seoul).
isKnownKoreanPostcodefunctionWhether GeoNames' list for South Korea has a postcode (34,249 of them).
isValidKoreanPostcodefunctionWhether a postcode follows Korea Post's shape: five digits.
KoreaPostFormattingOptionstypeOptions for formatKoreaPost.
KR_PROVINCESconstantThe metropolitan cities and provinces of South Korea.
looksKoreanfunctionWhether an address is surely Korean, with no hint: it ends with South Korea, Korea or 대한민국, or it is written in Hangul with the name of a metropolitan city or province, or a road and its number, or it is written in Latin letters with a road (-ro, -daero, -gil), a province's name and a postcode the list has before the end.
ParsedAddresstypeWhat parseLocation returns: every part it found, each absent when the address has none.
parseKoreanAddressfunctionParses 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).
parseKoreanPostcodefunctionTakes a postcode apart: the province it is in, and whether GeoNames' list has it.
ParseOptionstypeOptions for every parser: the country, strict postal codes, snake_case keys and the rest.
PostcodeLookuptypeA postcode taken apart: its canonical form, the region it is in (when the country's table has regions), and whether the country's list has it.
PostcodeRegiontypeA region a postcode can be in, as a country's table holds it: its code, its ISO 3166-2 code, and its name in English and in Japanese (from kuni, which takes them from Unicode CLDR and Wikidata).
southKoreaconstantSouth 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.
validateKoreanAddressfunctionChecks an address in South Korea: the postcode is five digits and GeoNames' list has it, the province written agrees with the postcode's, and the road's building number and the district are given.
ValidationErrortypeOne finding of a validator: the field it is about, its code, a message, and how serious it is.
ValidationOptionstypeOptions for the validators: which parts an address must have, which kinds are allowed, and whether a postal code that does not match its region is an error.

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