Development of a JS library for searching between address and postcode
Introduction
In Chinese postal system, a postcode is identified by three levels: province, city and county. This package allows you to search search the postcode by the given address identified by those three parameters. It also provides the functionality to search address from a given postcode.
GitHub page: (https://github.com/xtu/chinese-postcode)
NPM: (https://www.npmjs.com/package/chinese-postcode)
Try it on RunKit: (https://runkit.com/embed/fa31ejpzgvd1)
This package would enable developers to provide a functionality that automatically fills postcode for users. Postcode system is very poor designed in China so people don't often remember them.
Install
To get started, simply install it with npm:
npm install chinese-postcode
Usage
var pc = require('chinese-postcode');
// search addresses by postcode
var addresses = pc.getAddress('100093');
// search postcode by address
var postcode = pc.getPostcode({
province: '湖南',
city: '怀化市',
county: '靖州苗族侗族自治县'
});
API
The public APIs have documentations so the usages are quite easy to follow.
- Search addresses by a specified postcode.
/**
* @param postcode The postcode to be searched for.
* @returns Returns the addresses that use this postcode. Note it might return more than one address. Returns undefined if not found.
*/
function getAddress(postcode: string): Address[];
- Search postcode by a specified address.
/**
* @param address The address to be searched for.
* @returns Returns the postcode of this address. Returns undefined if not found.
*/
function getPostcode(address: Address): string;
Posted on Utopian.io - Rewarding Open Source Contributors
Your contribution cannot be approved because it does not follow the Utopian Rules.
On Utopian we want actively maintained and promising Open Source projects and no private projects. Simply uploading files to GitHub is not the way to go. You need to carefully prepare your project and provide information for others, both users and developers, to participate. The project should be up-to-date and documented and the development should happen in an organized and transparent manner, using Git/GitHub, to qualify as an open source project on Utopian.
You can contact us on Discord.
[utopian-moderator]