Socket
Socket
Sign inDemoInstall

zidian

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    zidian

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


Version published
Maintainers
1
Install size
61.6 MB
Created

Readme

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

FAQs

Last updated on 27 Jun 2021

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc