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

gb-t-2260

v1.0.0

Published

中华人民共和国国家标准 GB/T 2260 行政区划代码(JSON RAW)

Downloads

15

Readme

GB/T 2260

中华人民共和国国家标准 GB/T 2260 行政区划代码

tb-t-2260,为什么会是一个这个丑的字符串呢?很简单,因为 GB/T 2260 进行简单的「中横线处理」后就是了。(比较符合程序员思维,你懂我的意思吧?)

GB/T 2260 国家推荐县级以上行政区规划代码,记住,很多仓库都忽略了 T,这个 T 就是推荐的意思,国家发布的标准是 GB/T 而不是 GB(国标)哟!

那么这个仓库做的事情很简单,就是将最新的 GB/T 2260 数据整理后提供给你,所以这个仓库是不包含代码的,但是对不同的语言和包管理工具提供了不同的使用方法,但是使用的数据源都是一个。

允许使用途径

使用

无论你用何种方式,使用的 RAW 内容均为 resources/gb-t-2260.json 这一份文件的内容,它的结构很简单,下面是一份预览:

{
    "110000": "北京市",
    "110101": "东城区",
    "110102": "西城区",
    "110105": "朝阳区",
    // ...
}

其中 Key 就是行政代码,而 Value 就是代码对应的地区县名称。

PHP

使用 PHP 版本,你可以使用 Composer 快速的下载:

composer require medz/gb-t-2260

下载后,这个包提供了地区 JSON RAW 文件和一个 PHP 常量,常量叫做 MEDZ_GBT2260_RAW_PATH,顾名思义,这个常量就是记录的 JSON RAW 文件的路径,得到路径你就可以自由操作了。例如:

$jsonRaw = file_get_contents(MEDZ_GBT2260_RAW_PATH);
$jsonObject = json_decode($jsonRaw);

// 现在你可以分别 dump 出两个变量,看其中的内容

JavaScript

你可以使用 NPM 或者 Yarn 任意一个工具,但是推荐你的项目是允许进行 require JSON 文件的导入功能的。(关于在工程直接导入 json 可以看一下 webpack 插件等,目前很多脚手架均支持,若你遇到问题请在仓库 Issues 山提出。)

# NPM
npm -i gb-t-2260

# Yarn
yarn add gb-t-2260