Socket
Book a DemoInstallSign in
Socket

zidian

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zidian

汉字、词语、成语查询接口

0.0.3
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

zidian 字典

汉字、词语、成语查询接口

引言

  • 数据来源于开源项目 https://github.com/pwxcoo/chinese-xinhua
  • 而该项目的数据是一个JSON文件,大小超出 20M,不利于页面加载使用,所以拆分了文件
  • 提取字、词、成语为数组,根据数组索引分页生成详情,具体请看 build/parse.html 的拆分脚本

使用

<script src="https://cdn.jsdelivr.net/npm/zidian@0.0.3/dist/zidian.js"></script>
<!-- or -->
<script src="https://cdn.jsdelivr.net/gh/netnr/zidian/dist/zidian.js"></script>

查看 https://unpkg.com/zidian/
拉取 npm install zidian

汉字查询

zidian.equalWord(key)
zidian.equalWord("爱").then(console.log)

词语查询

zidian.equalCi(key)
zidian.equalCi("美丽").then(console.log)

成语查询

zidian.equalIdiom(key)
zidian.equalIdiom("叶公好龙").then(console.log)

词语模糊搜索

zidian.likeCi(key)
zidian.likeCi("美").then(console.log)

成语模糊搜索

zidian.likeIdiom(key)
zidian.likeIdiom("三百").then(console.log)

说明

  • 接口查询返回一个 Promise 对象
  • 查询的接口会缓存到 zidian.cache 对象
  • 查询无记录时,返回 null
  • zidian.config.host 可配置请求源

Keywords

zidian 汉字 词语 成语 查询接口

FAQs

Package last updated on 27 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.