npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

goqzipcode

v1.1.7

Published

GoqZipCodeは、郵便番号もしくは住所から該当する住所を検索し、住所データを受け取ることができます。

Readme

GoqZipCode

GoqZipCodeは、郵便番号もしくは住所から該当する住所を検索し、住所データを受け取ることができます。

目次

サポートブラウザ

InternetExplorerを除く、モダンブラウザで使用可能です。 

デモページ

以下のデモページから使用できるメソッドやオプションの一覧が確認できます。
デモページへ

インストール

npmを使用します。

$ npm install goqzipcode

もしくはyarnを使用します。

$ yarn add goqzipcode

CDNも利用可能です。

<script src="https://cdn.jsdelivr.net/npm/goqzipcode@latest/dist/index.min.js"></script>

API

初期化

インポートしたGoqZipCodeを初期化します。

初期化はSSR(サーバーサイドレンダリング)では動きません。
SSRを使用している場合、クライアントサイドで実行するように記述してください。

// commonjs
const { GoqZipCode } = require('goqzipcode')
// ES6
import { GoqZipCode } from 'goqzipcode'
// initialize
const goqZipCode = new GoqZipCode()

オプション

| 名前 | 型 | 初期値 | 説明 | ----|----|----|---- | limit | number | 50 | 取得する住所の上限 | | is_hyphen | boolean | true | 返り値の郵便番号にハイフン(-)を含むか |

const options = {
  limit: 100,
  is_hyphen: false
};

const goqZipCode = new GoqZipCode(options);

データ返り値

配列の中に該当したデータがオブジェクト形式で返ります。

| 名前 | 型 | 説明 | ----|----|---- | city | string | 市区 | | pref | string | 都道府県 | | town | string | 町村 | | zipcode | string | 郵便番号 |

[
  {
    city: "",
    pref: "",
    town: "",
    zipcode: ""
  }
]

郵便番号から住所を検索

郵便番号から住所を検索するにはsearchAddressFromZipcodeメソッドを使用します。
データを検索するタイミングとして、完全一致前方一致が可能です。

※ -(ハイフン)があった場合、-は除外してカウントされます。

引数のオブジェクトプロパティは以下を設定します。

| 名前 | 型 | 説明 | 必須 | デフォルト値 ----|----|----|----|---- | zipcode | string | 郵便番号 | true | "" | is_exact | boolean | 完全一致の有無 | | false

完全一致

入力番号が7文字必須です。
入力番号と一致したデータを返します。

goqZipCode.searchAddressFromZipcode({
  zipcode: '1040031',
  is_exact: true
})
  .then(result => {
    // do sccess handling 
  })
  .catch(() => {
    // do failure handling 
  })

前方一致

入力番号が2文字以上必須です。
入力番号から都度データ照合をして、該当したデータを返します。

goqZipCode.searchAddressFromZipcode({
  zipcode: '1040031',
})
  .then(result => {
    // do sccess handling 
  })
  .catch(() => {
    // do failure handling 
  })

住所から郵便番号を検索

住所から郵便番号を検索するにはsearchZipcodeFromAddressメソッドを使用します。
データを検索するタイミングとして、完全一致前方一致部分一致が可能です。

※いずれも3文字以上必須になります。

引数のオブジェクトプロパティは以下を設定します。

| 名前 | 型 | 説明 | 必須 | デフォルト値 ----|----|----|----|---- | address | string | 住所 | true | "" | is_exact | boolean | 完全一致の有無 | | false | is_left | boolean | 前方一致の有無 | | false

完全一致

入力された住所と一致したデータを返します。

goqZipCode.searchZipcodeFromAddress({
  address: '東京都中央区京橋',
  is_exact: true
})
  .then(result => {
    // do sccess handling 
  })
  .catch(() => {
    // do failure handling 
  })

前方一致

入力された住所と都度データ照合をして、該当したデータを返します。

goqZipCode.searchZipcodeFromAddress({
  address: '東京都中央区',
  is_left: true
})
  .then(result => {
    // do sccess handling 
  })
  .catch(() => {
    // do failure handling 
  })

部分一致

入力された住所が部分的に該当したデータを返します。

goqZipCode.searchZipcodeFromAddress({
  address: '中央区京橋',
})
  .then(result => {
    // do sccess handling 
  })
  .catch(() => {
    // do failure handling 
  })