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

@oyz-lib/province-city-china-min

v1.0.6

Published

中国省市县数据,树形结构,用于前端树形选择组件,数据经过极致压缩

Downloads

8

Readme

npm package Downloads

中华人民共和国行政区划代码数据

  • 通过压缩数据,减少体积,提高加载速度

  • 中华人民共和国行政区划(五级):省级、地级、县级、乡级和村级。来自中华人民共和国民政部,用于查询中国省,市和区数据的网站。

  • 中华人民共和国行政区划代码,更新时间:2021-01-04

  • 统计用区划和城乡划分代码,更新时间:2021-12-30

npm install @oyz-lib/province-city-china-min

使用:

import DataMin from "@oyz-lib/province-city-china-min";
import levelData from "@oyz-lib/province-city-china-min/data/level.json";

const tree = DataMin.getData(levelData);
console.log(tree);

| 名称 | 类型 | 说明 | | ---------- | ------------- | ------------- | | getData | (data: string | string[]) => DataItem | 获取数据 | | getCountry | (data: string | string[]) => Country | 获取国家数据 |

json数据:

| 名称 | 说明 | 使用方法 | 文件大小 | 下载地址 | | ------------------------------------- | ------------------ | ---------- | -------- | -------- | | country.json | 国家 | getCountry | 11kb | 下载 | | province.json | 省级(省/直辖市/特别行政区) | getData | 496字节 | 下载 | | city.json | 地级(城市) | getData | 5kb | 下载 | | area.json | 县级(区县) | getData | 47kb | 下载 | | town.json | 乡级(乡镇/街) | getData | 591kb | 下载 | | level.json | 树形结构,省/市/县 | getData | 53kb | 下载 | | data.json | 省/市/县 | getData | 641kb | 下载 | | district-code.json | 国内长途电话区号 | getData | 4kb | 下载 |

可以将文件放入资源目录,异步下载后调用DataMin方法。

类型定义:

export declare interface Country {
  // 序号
  id: number;
  // 中文简称
  cnname: string;
  // 英文简称
  name: string;
  // 英文全称
  fullnam: string;
  // 两字母代码
  alpha2: string;
  // 三字母代码
  alpha3: string;
  // 数字代码
  numeric: number;
}

export declare interface DataItem {
  code: string;
  name: string;
  // 省级(省/直辖市/特别行政区)
  province: string;
  // 地级(城市)
  city: string;
  // 县级(区县)
  area: string;
  // 乡级(乡镇/街)
  town: string;
  children?: DataItem[];
}

province 第一位表示:华北区1,东北区2,华东区3,中南区4,西南区5,西北区6。 如 湖北省 -> 42 以 4 开头,表示为 中南区。

License

MIT