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

@xiee/zdict

v1.2.4

Published

汉典网站数据(通用汉字、拼音、释义等)

Downloads

9

Readme

zdict.js

汉字、拼音、释义等数据。

目前包含:

中文识字应用

HTML 页面上创建一个 idleanr-chars<div> 容器,再加载 JS 脚本和 CSS,即可生成一个中文识字应用界面。若页面内不存在这个容器,那么界面将在 JS 脚本之后创建。参见这里的示例页面

<div id="learn-chars"></div>

<link href="https://cdn.jsdelivr.net/npm/@xiee/zdict/css/learn-chars.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/@xiee/zdict/js/learn-chars.min.js" defer></script>

汉字数据

若想单独加载数据模块,可以在 JS 中 import 导入或者在 Node 中 require() 加载 zdict.js,其包含两个成员:chars 是七千通用汉字数据,freqs 是按频度排序的七千汉字。

// JavaScript 模块
import zDict from "./zdict.js";
zDict.chars['一'];
zDict.freqs;
// Node
const zDict = require('@xiee/zdict');
zDict.chars['一'];
zDict.freqs;

若在浏览器中加载 jsdelivr 中的 zdict.min.js 那么会得到一个全局对象 zDict

<script src="https://cdn.jsdelivr.net/npm/@xiee/zdict/js/zdict.min.js" defer></script>
<script>
zDict.chars['一'];
zDict.freqs;
</script>

韵母分组字表

HTML 页面上创建一个 idpinyin-finals 的容器,然后即可结合 JS 和 CSS 生成一个按韵母分组的字表。参见这里的示例页面

<div id="pinyin-finals"></div>

<link href="https://cdn.jsdelivr.net/npm/@xiee/zdict/css/pinyin-finals.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/@xiee/zdict/js/pinyin-finals.min.js" defer></script>

注意本库中的 JS 源代码是以 JS 模块的方式写的,在发布到 NPM 之前上经过了 rollup 打包,以便它们能同时在浏览器和 Node 中使用。