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

zpinyin

v1.1.9

Published

拼音模糊查询 首字母/高性能/全拼

Downloads

89

Readme

zpinyin

npm

前言

zpinyin轻量级前端拼音模糊检索插件
使用原数据与索引数据区分模式,原数据大小不会对检索查询速度造成影响。
检索索引一次建立后续直接使用,大幅优化检索效率。


概述

该插件收录常用汉字6763个
支持检索模式(当前版本不支持单独配置默认全部开启)

  • 首字母查询
  • 常规查询
  • 不区分大小写的查询
  • 全拼查询

在线演示:http://zhhcho.com:3012/

使用者指南

通过npm下载安装代码

npm install --save zpinyin

示例

目前版本仅支持原数据为对象数组和指定对象对应key来进行检索

//导入拼音插件
import zpinyin from 'zpinyin';

/*初始化
new zpinyin(data,key)
@param data 源数据 [{'name':'张三','age':'22','workCode':'YQ1000'},{'name':'李四','age':'22','workCode':'YQ1000'}]
@param key 能被检索的key值  数组类型 如 检索姓名 ['name']
*/
var data = [{'name':'张三','age':'22','workCode':'YQ1200'},{'name':'李四','age':'22','workCode':'YQ1000'}]
var userQuery = new zpinyin(data,['name','workCode']);

var test1 = userQuery.query('li') // {'name':'李四','age':'22','workCode':'YQ1000'}
var test1 = userQuery.query('ls') // {'name':'李四','age':'22','workCode':'YQ1000'}
var test1 = userQuery.query('shi') // {'name':'李四','age':'22','workCode':'YQ1000'}
var test1 = userQuery.query('lishi') // {'name':'李四','age':'22','workCode':'YQ1000'}
var test1 = userQuery.query('100') // {'name':'李四','age':'22','workCode':'YQ1000'}
var test1 = userQuery.query('yq') // {'name':'李四','age':'22','workCode':'YQ1000'},{'name':'张三','age':'22','workCode':'YQ1200'}

//可以同时存在多个
var data2 = [{'name':'王五','age':'22','workCode':'YQ1200'},{'name':'钱六','age':'22','workCode':'YQ1000'}]
var userQuery2 = new zpinyin(data2,['name','workCode']);

//userQuery2
var test2 = userQuery.query('ww') // {'name':'王五','age':'22','workCode':'YQ1200'}
//userQuery
var test1 = userQuery.query('ls') // {'name':'李四','age':'22','workCode':'YQ1000'}

版本

|版本号|更新内容|备注| |:-|:-:|-:| |1.1.4|添加在线演示|-| |1.1.0|添加自述文件,删除多余console|-|