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

provincecityinchina

v1.0.9

Published

getting and formatting chinese provinces and cities

Downloads

18

Readme

ProvinceCityInChina

Geting and formatting chinese provinces and cities

一个小功能,用来获取中国的省和市

Installation

npm install provincecityinchina 

Usage

var china = require('provincecityinchina');

Help

node your-script.js -h

or

node your-script.js --help

Config

node your-script.js -s data-file-path

or

node your-script.js --save data-file-path

在你的脚本文件中引入模块后,使用此命令执行你的脚本文件,创建数据文件,数据文件名、路径自定义

Methonds

  • getAll
  • getProvince
  • getCity

Specific

getAll(path)

get all data from saved data file

从数据文件中获取所有信息

china.getAll('data.json');

getProvince(path)

get province name from saved data file

从数据文件中获取中国的34个省、市、直辖市、特别行政区

china.getProvinceName('data.json');

getCity(path,index)

get city name by province index from saved data file,this is province map:

从数据文件中获取具体的某个省、市、直辖市、特别行政区的市或县,通过如下编号获取:

china.getCityNameByProvince('data.json',1)               // get "shanghai's city"


['上海市','云南省','内蒙古','北京市','台湾省', 
//  1        2       3        4       5
//
 '吉林省','四川省','天津市','宁夏','安徽省',
//  6        7       8       9      10
//
 '山东省','山西省','广东省','广西','新疆',     
//  11       12      13     14     15
//
 '江苏省','江西省','河北省','河南省','浙江省',
//  16      17       18      19       20 
//
 '海南省','湖北省','湖南省','澳门特别行政区','甘肃省', 
//  21      22       23          24          25
//
 '福建省','西藏','贵州省','辽宁省','重庆市',             
// 26     27     28       29       30
//
 '陕西省','青海省','香港特别行政区','黑龙江省' ] 
// 31      32          33           34

数据来自中国地区代码表