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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@louismax/cn-area-cascader-core

v0.1.1

Published

China area tree data and framework-agnostic utilities.

Readme

@louismax/cn-area-cascader-core

中国省市区数据与无框架工具函数。

安装

yarn add @louismax/cn-area-cascader-core

数据

import { chinaAreaTreeFull } from '@louismax/cn-area-cascader-core/full'

默认数据:工具函数在不传 data 时会自动使用内置 chinaAreaTree(不再需要手动传入);如果你有自定义树数据,可在调用时手工传入第三方参数。

工具函数

import {
  findAreaByValue,
  findAreaPathByValue,
  flattenAreaTree,
  getAreaText,
  createAreaModelValue,
  createAreaModelValues
} from '@louismax/cn-area-cascader-core'

函数说明

defaultAreaProps        默认字段映射
flattenAreaTree         将树形省市区数据拍平成数组
findAreaByValue         根据编码查找区域节点
findAreaPath            根据路径编码查找路径节点
findAreaPathByValue     根据单个编码反查完整路径节点
getAreaText             根据路径编码生成展示文本
compactAreaSelection    多选时将全选子级折叠为父级
expandAreaSelection     将父级选择展开为所有叶子节点
createAreaModelValue    将单个编码转换为组件 v-model 值
createAreaModelValues   将多个编码转换为组件多选 v-model 值

基础查询

const node = findAreaByValue('110101')
const path = findAreaPathByValue('110101')
const text = getAreaText(['110000', '110100', '110101'])

多选折叠

const compactNodes = compactAreaSelection(['110101', '110102'])
const leafNodes = expandAreaSelection(['110100'])

编辑回填

const value = createAreaModelValue('110101', {
  mode: 'leaf-node'
})

多选:

const values = createAreaModelValues(['110101', '110102'], {
  mode: 'leaf-node'
})

License

MIT