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

@lx-frontend/city-data

v1.1.0

Published

中国省份城市区数据

Downloads

9

Readme

cityData 中国省市区三级联动数据

npm npm Build Status Coverage Status

更新日志

1.2.6

  1. 将默认引入文件index.js拆分为移动端和PC端文件,以方便按需引入
  2. 调整文件目录结构

1.2.4

  1. 调整cvux数据格式

1.2.3

  1. 将rollup打包的格式改为cjs
  2. 将默认引入文件制定为lib/index.js

1.2.2

  1. 版本代码风格升级为es6, 以便支持treeshake
  2. es5(umd) 格式代码在lib目录,但是由于要支持pc和cvux,代码量大了一倍,且无法treeshake
  3. 用户默认引用的是es6的代码

使用说明

  1. 安装npm包:

    npm install city-data
  2. 引入使用:可参考安装包lib/index.js,自定义名称,按需引入

    // cvux格式文件,及工具函数引入
    import { cvux as 自定义名称, tools } from 'city-data/lib/mobile'
    const value2name = tools.value2name
    const name2value = tools.name2value
    
    // pc格式文件,及工具函数引入
    import { province, city, area, tools } from 'city-data/lib/pc'
    const value2name = tools.value2name
    const name2value = tools.name2value
  3. 构建打包命令

  • npm run build 生成新的lib,但不会重新生成cvux和pc端数据
  • npm run build:all 首先从源数据重新生成cvux和pc端数据,接着生成行的lib包

数据说明

  1. 源数据为back_end_data.js,我司后端使用的源数据

  2. 生成前端数据格式的指令:

  • npm run build-cvux:生成前端cvux中使用的数据格式,./data/china_address_cvux.json

      [
        {
            "name": "北京市",
            "value": "110000"
        },
        ...
      ]
  • npm run build-pc:生成前端pc中使用的数据格式,./data/china_address_pc.js

      module.exports = {
        province: [],
        city: [],
        area: []
      }

数据来源说明

  • 参照china-area-datanpm包,使用国家统计局发布的省市区文件,根据我司业务情况,对数据进行了修改

Github👏

Github

License

MIT