2.0.0 • Published 3 years ago

todofuken v2.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
3 years ago

todofuken v2.0.0

Address auto complete library with japan post number powered by Japan post API (郵便番号検索 API).

This module supports synchronous update. All database(~16MB) is saved.

Installation

npm i todofuken

⚠ This npm package requires actual database. click here to download and unzip it under ./db/

Usage

⚠ Module only takes 7 digits String which is japan postal code (日本郵便番号)

// CommonJS
const todofuken = require("todofuken")

// ES6
import todofuken from "todofuken"

// Usage
const postNumber = "822-0034"
// const postNumber = "8220034"
// const postNumber =  8220034

// Requires frontend filtering
const query = postNumber.match(/\d/g).join("")

// Module
const result = todofuken(query)

// Result
result = {
  8220034: {
    prefecture: "福岡県",
    city: "直方市",
    area: "山部",
    code: "40",
  },
}

// If not loaded, todofuken() returns false
result = false

Database updated

2020 Nov 30