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 🙏

© 2024 – Pkg Stats / Ryan Hefner

addrtozip

v1.1.1

Published

API for finding zipcode by address in Taiwan

Downloads

8

Readme

API for finding zipcode in Taiwan NPM version Build Status

NPM

This package is reference from mosky .

Installation

$ npm install addrtozip

Usage

####First you have to require the package.

var addrtozip = require('addrtozip');

Send an address to query zipcode.

addr: Required. An address for finding zipcode

callback: Required. Callback will return a json contain zipcode and address.

addrtozip.find(addr, callback);

Example

var addrtozip = require('addrtozip');
addrtozip.find('台北市信義區市府路45號', function (zipcode){
  console.log(zipcode);
}

And you will get a json data, like this.

{ "zipcode": '11001', "addr": '台北市信義區市府路45號' }

Gradual

A legal address contain city(縣市), area(鄉鎮市區), street(路街巷弄號), and exclude village(村里) and neighborhood(鄰). We also can find informal zipcode gradually, but that will reduce the precision.

var addrtozip = require('addrtozip');
addrtozip.find('台北市', function (zipcode){
  // { zipcode: '1', addr: '台北市' }
}
addrtozip.find('台北市信義區', function (zipcode){
  // { zipcode: '110', addr: '台北市信義區' }
}
addrtozip.find('台北市信義區市府路', function (zipcode){
  // { zipcode: '110', addr: '台北市信義區市府路' }
}
addrtozip.find('台北市信義區市府路45號', function (zipcode){
  // { zipcode: '11001', addr: '台北市信義區市府路45號' }
}

Get city list

Just get city list

var addrtozip = require('addrtozip');
addrtozip.getCities(function (err, cities) {
  /*
    [ { cityName: 'Taipei City', zh_tw: '臺北市' },
    { cityName: 'Lienchiang County', zh_tw: '連江縣' },
    { cityName: 'Hsinchu City', zh_tw: '新竹市' },
    { cityName: 'New Taipei City', zh_tw: '新北市' },
    { cityName: 'Taoyuan County', zh_tw: '桃園縣' },
    { cityName: 'Miaoli County', zh_tw: '苗栗縣' },
    { cityName: 'Taichung City', zh_tw: '臺中市' },
    { cityName: 'Changhua County', zh_tw: '彰化縣' },
    { cityName: 'Nantou County', zh_tw: '南投縣' },
    { cityName: 'Chiayi City', zh_tw: '嘉義市' },
    { cityName: 'Chiayi County', zh_tw: '嘉義縣' },
    { cityName: 'Yunlin County', zh_tw: '雲林縣' },
    { cityName: 'Tainan City', zh_tw: '臺南市' },
    { cityName: 'Kaohsiung City', zh_tw: '高雄市' },
    { cityName: 'Penghu County', zh_tw: '澎湖縣' },
    { cityName: 'Kinmen County', zh_tw: '金門縣' },
    { cityName: 'Pingtung County', zh_tw: '屏東縣' },
    { cityName: 'Taitung County', zh_tw: '臺東縣' },
    { cityName: 'Hualien County', zh_tw: '花蓮縣' },
    { cityName: 'Keelung City', zh_tw: '基隆市' },
    { cityName: 'Hsinchu County', zh_tw: '新竹縣' },
    { cityName: 'Yilan County', zh_tw: '宜蘭縣' } ]
  */
})

Get cityareas list

Just get cityareas list

var addrtozip = require('addrtozip');
addrtozip.getAreas('台北市', function (err, areas) {
  /*
    [ { areaName: 'Zhongzheng Dist.',
        zh_tw: '中正區',
        belongCity: 'Taipei City' },
      { areaName: 'Datong Dist.',
        zh_tw: '大同區',
        belongCity: 'Taipei City' },
      { areaName: 'Zhongshan Dist.',
        zh_tw: '中山區',
        belongCity: 'Taipei City' },
      { areaName: 'Songshan Dist.',
        zh_tw: '松山區',
        belongCity: 'Taipei City' },
      { areaName: 'Da’an Dist.',
        zh_tw: '大安區',
        belongCity: 'Taipei City' },
      { areaName: 'Wanhua Dist.',
        zh_tw: '萬華區',
        belongCity: 'Taipei City' },
      { areaName: 'Xinyi Dist.',
        zh_tw: '信義區',
        belongCity: 'Taipei City' },
      { areaName: 'Shilin Dist.',
        zh_tw: '士林區',
        belongCity: 'Taipei City' },
      { areaName: 'Beitou Dist.',
        zh_tw: '北投區',
        belongCity: 'Taipei City' },
      { areaName: 'Neihu Dist.',
        zh_tw: '內湖區',
        belongCity: 'Taipei City' },
      { areaName: 'Nangang Dist.',
        zh_tw: '南港區',
        belongCity: 'Taipei City' },
      { areaName: 'Wenshan Dist.',
        zh_tw: '文山區',
        belongCity: 'Taipei City' } ]
  */
})

If any adress is legal, but return wrong zipcode. Please let me know. Thanks.