japan-postal-code-oasis

0.2.11 • Public • Published

Japan Postal code oasis

JavaScript module for Japan Postal Code.

Forked from https://github.com/mzp/japan-postal-code

Features

  • ES6 modules
  • Promise
  • No dependency
  • Customize data url(must host yourself)
  • Bundle version (WIP)

How to install

npm install japan-postal-code-oasis

How to use

const postal = import 'japan-postal-code-oasis';

const DATA_URI_BASE = 'https://example.com/path/to/data/';
// Update the URL to the base URL of your JSON data files

postal.configure(DATA_URI_BASE);

postal('1000001').then(address => {
  console.log(address.prefecture); // => "東京都"
  console.log(address.city); // => "千代田区"
  console.log(address.area); // => "千代田"
  console.log(address.street); // => ""
});

or

const postal = import 'japan-postal-code-oasis';

const DATA_URI_BASE = 'https://example.com/path/to/data/';
// Update the URL to the base URL of your JSON data files

postal('1000001', DATA_URI_BASE).then(address => {
  console.log(address.prefecture); // => "東京都"
  console.log(address.city); // => "千代田区"
  console.log(address.area); // => "千代田"
  console.log(address.street); // => ""
});

LICENSE

MIT License

Readme

Keywords

Package Sidebar

Install

npm i japan-postal-code-oasis

Weekly Downloads

114

Version

0.2.11

License

MIT License

Unpacked Size

6.76 MB

Total Files

960

Last publish

Collaborators

  • othree