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 · Japanese addresses

getPostalPrefixesForPrefecturefunction

The three-digit postal prefixes a prefecture's codes begin with, the reverse of getPrefectureFromJapanesePostalCode. A prefix on a border is listed under the prefecture most of its codes belong to.

Import it

import { getPostalPrefixesForPrefecture } from "@johnmorrisdotca/address-plus/jp";

Also exported from: @johnmorrisdotca/address-plus

Definition

function getPostalPrefixesForPrefecture(prefecture: string): string[]

Parameters

NameTypeDescription
prefecturestring

The prefecture, by JIS code, name or romaji, as findPrefecture reads it.

Returns

string[]

The prefixes in ascending order, an empty array for an unknown prefecture.

Examples

import { getPostalPrefixesForPrefecture } from "@johnmorrisdotca/address-plus/jp";

console.log(getPostalPrefixesForPrefecture("沖縄県"));
// → ["900","901","902","903","904","905","906","907"]
[
  '900', '901',
  '902', '903',
  '904', '905',
  '906', '907'
]

What it prints (run when this page was built)

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