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

@senntyou/china-regions

v0.1.0

Published

中国行政区划【省、市、区县】数据(汇总、省份、地级市、区县、一级、二级、三级)(另加海外数据)

Downloads

4

Readme

中国行政区划【省、市、区县】数据(汇总、省份、地级市、区县、一级、二级、三级)(另加海外数据)

一级数据

import oneLevel from '@senntyou/china-regions/lib/one-level.json';

省份:一级数据

[
  {
    "code": "110000",
    "name": "北京市"
  },
  {
    "code": "120000",
    "name": "天津市"
  },
  ...
]

二级数据

import twoLevels from '@senntyou/china-regions/lib/two-levels.json';

省份 + 地级市(区县):二级数据

[
  {
    "code": "110000",
    "name": "北京市",
    "children": [
      {
        "code": "110101",
        "name": "东城区"
      },
      ...
    ]
  },
  ...
  {
    "code": "130000",
    "name": "河北省",
    "children": [
      {
        "code": "130100",
        "name": "石家庄市"
      },
      ...
    ]
  }
  ...
]

注意:

  • 对于一般的省份,第二级数据列出的是 地级市 + 直接隶属省级的区县
  • 对于直辖市、特别行政区等,第二级数据列出的是 区县 一级

三级数据

import threeLevels from '@senntyou/china-regions/lib/three-levels.json';

省份 + 地级市 + 区县:三级数据

[
  {
    "code": "110000",
    "name": "北京市",
    "children": [
      {
        "code": "110101",
        "name": "东城区"
      },
      ...
    ]
  },
  ...
  {
    "code": "130000",
    "name": "河北省",
    "children": [
      {
        "code": "130100",
        "name": "石家庄市",
        "children": [
          {
            "code": "130102",
            "name": "长安区"
          },
          ...
        ]
      },
      ...
    ]
  }
  ...
]

注意:

  • 一般来说是按照 省份:地级市:区县 的顺序填入数据的
  • 对于直辖市、特别行政区等,第二级数据列出的是 区县 一级,而不存在第三级数据
  • 对于直接隶属省级的区县,第二级数据列出的是 区县 一级,而不存在第三级数据
  • 对于没有区县一级的地级市,不存在第三级数据

三级数据(填充至完整的 3 级)

import threeLevelsFull from '@senntyou/china-regions/lib/three-levels-full.json';

省份 + 地级市 + 区县:三级数据(填充至完整的 3 级)

[
  {
    "code": "110000",
    "name": "北京市",
    "children": [
      {
        "code": "110101",
        "name": "东城区",
          "children": [
            {
              "code": "110101",
              "name": "东城区"
            }
          ]
      },
      ...
    ]
  },
  ...
  {
    "code": "130000",
    "name": "河北省",
    "children": [
      {
        "code": "130100",
        "name": "石家庄市",
        "children": [
          {
            "code": "130102",
            "name": "长安区"
          },
          ...
        ]
      },
      ...
    ]
  }
  ...
]

注意:

  • 一般来说是按照 省份:地级市:区县 的顺序填入数据的
  • 对于直辖市、特别行政区等,第二级数据列出的是 区县 一级,第三级使用和第二级一样的数据
  • 对于直接隶属省级的区县,第二级数据列出的是 区县 一级,第三级使用和第二级一样的数据
  • 对于没有区县一级的地级市,第三级使用和第二级一样的数据

特殊情况举例

  • 直辖市:北京、天津、上海、重庆
  • 特别行政区:香港、澳门
  • 直接隶属省级的区县:海南五指山市、琼海市等
  • 无区县的地级市:广东东莞、中山等

海外数据

国内省市区之外的海外国家一级数据

编码规则

  • 第一级:code: 990000, name: 海外
  • 第二级:code: 99xxxx, name: 美国/英国...
  • 国家编码规则:99 + 填充0 + 国际区号 ,当国际区号不足 4 位时,前面用 0 填充,补足 4 位,整个补足 6 位
  • 因为美国和加拿大国际区号一样,所以改加拿大国际区号为 2

海外二级数据

import countryLevels from '@senntyou/china-regions/lib/country-levels.json';
[
  {
    "code": "990000",
    "name": "海外",
    "children": [
      {
        "code": "990001",
        "name": "美国"
      },
      {
        "code": "990002",
        "name": "加拿大"
      },
      ...
    ]
  }
]