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

@ytfee/district

v0.0.4

Published

中国行政区划解析

Downloads

5

Readme

使用方法

yarn add @ytfee/district or npm install @ytfee/district

  • broswer
import district from '@ytfee/district'
console.log(district.getData())

or

import { getData, getDetail, format } from '@ytfee/district'
console.log(getData())
  • node
const district = require('@ytfee/district')
console.log(district.getData())

or

const { getData, getDetail, format } = require('@ytfee/district')
console.log(getData())
  • getData将返回常规行政区划编码原始数据
  • getDetail传入原始数据及任意编码返回所有详细信息
interface PropString {
  [propName: string]: string
}
interface DetailResult {
  provinces: PropString
  province: string
  provinceName: string
  citys: PropString
  city: string
  cityName: string
  countys: PropString
  county: string
  countyName: string
}

测试用例

getData().then(async ({result, message}) => {
  console.log('0 getData', message, 'output test.json')
  console.log('1----------> province', getDetail(result, {province: '110000'}))
  console.log('2----------> city', getDetail(result, {city: '140300'}))
  console.log('3----------> city 中山市', getDetail(result, {city: '442000'}))
  console.log('4----------> county', getDetail(result, {county: '451102'}))
  console.log('5----------> county 中山市', getDetail(result, {county: '442000'}))
  console.log('6----------> code 省', getDetail(result, {code: '110000'}))
  console.log('7----------> code 市', getDetail(result, {code: '140300'}))
  console.log('8----------> code 区', getDetail(result, {code: '451102'}))
  console.log('9----------> code 中山市', getDetail(result, {code: '442000'}))
  const formatData = format(result, 'elementui2')
})

基础规范

  1. src/main.js 为入口文件,导入所有方法
  2. src/_aBb*.js 下横杠驼峰为 公共方法
  3. src/aBb.js 驼峰格式为 工具方法
  4. src/AaBb.js 大驼峰格式为 工具类

发布规范

  1. 必须通过eslint和jest校验
  2. npm采用语义化版本,共三位,以’.’隔开,从左至右依次代表:主版本(major)、次要版本(minor)、补丁版本(patch)。
npm version patch
npm version minor
npm version major