JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 261
  • Score
    100M100P100Q83337F
  • License MIT

zipcodes of japanpost.jp as static properties

Package Exports

  • zipcode-ja

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (zipcode-ja) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

zipcode-ja

日本郵便 令和元年6月28日更新 郵便番号データ NodeJS / ブラウザ用 JavaScript

インストール

NodeJS

npm install zipcode-ja --save
import zipcodeJa from 'zipcode-ja';
console.log(zipcodeJa.version, zipcodeJa.lastModified); // '0.0.0', '2016-05-31'

ブラウザDownload Latest

<script src="zipcode-ja/lib/zipcode-ja.js"></script>
<script>
console.log(zipcodeJa.version, zipcodeJa.lastModified); // '0.0.0', '2016-05-31'
</script>

デモページ

使用方法

zipcodeJaは、一つの巨大なオブジェクトです。実在する郵便番号をキーとして与えると、対応する住所を返します。

console.log(zipcodeJa['1000002']);
// {
//   zipcode: '1000002',
//   zipcodeOld: '100',
//   jisX0402: '13101',
//   address: [
//     '東京都',
//     '千代田区',
//     '皇居外苑'
//   ],
//   ruby: [
//     'とうきょうと',
//     'ちよだく',
//     'こうきょがいえん'
//   ],
//   status: [
//     0,
//     0,
//     0,
//     0,
//     0,
//     0
//   ]
// }

それぞれのプロパティは、元データである郵便番号データの説明に対応しています。

  • zipcode郵便番号(7桁)
  • zipcodeOld(旧)郵便番号(5桁)
  • jisX0402全国地方公共団体コード(JIS X0401、X0402)
  • address都道府県名/漢字, 市区町村名/漢字, 町域名/漢字
  • ruby都道府県名/半角カタカナ, 市区町村名/半角カタカナ, 町域名/半角カタカナ
  • status
    1. 一町域が二以上の郵便番号で表される場合の表示
    2. 小字毎に番地が起番されている町域の表示
    3. 丁目を有する町域の場合の表示
    4. 一つの郵便番号で二以上の町域を表す場合の表示
    5. 更新の表示
    6. 変更理由

注意事項として

  • address町域名が「以下に掲載がない場合」を「」に置換
  • rubyは半角カタカナではなく、全角ひらがなに置換

これは、他のスクリプトから利用する際の手順を省略するための調整です。

他のライブラリとの差異

開発環境

下記がグローバルインストールされていることが前提です。

  • NodeJS v6.2.1
  • Npm v3.9.3 (or pnpm)
git clone https://github.com/59naga/zipcode-ja
cd zipcode-ja
npm install

npm test

License

MIT