Commit ee0f8ec7 authored by Jarrod's avatar Jarrod 💬

Update README

parent a61f4813
Pipeline #1301 passed with stages
in 48 seconds
# @zhdict/cedict-js
lalala
## @nahanil/cedict-js
Fallback data source for [zhdict.net](https://zhdict.net/)
```bash
npm install --save @nahanil/cedict-js
# OR
yarn add @nahanil/cedict-js
```
```js
const cedict = require('@nahanil/cedict-js')
```
### Search for a word or character
```js
let results = await cedict.search('水')
/*
* Always returns an array of results
[
{
"id": "a1e7fdf92f84aaca2675121d4b2b54eb5122bd97",
"simplified": "水",
"traditional": "水",
"pinyin": "shui3",
"english": "surname Shui/water/river/...",
"radicalSimplified": "水",
"radicalTraditional": "水",
"strokesSimplified": 4,
"strokesTraditional": 4,
"strokesMinRadSimplified": 0,
"strokesMinRadTraditional": 0,
"variantsSimplified": null,
"variantsTraditional": null,
"variants": "氵"
}
]
*/
let results = await cedict.search('你好')
/*
[
{
id: '985dfa1015cc66c20f15a40d93baf0445c871d5b',
simplified: '你好',
traditional: '你好',
pinyin: 'ni3 hao3',
english: 'hello/hi',
radicalSimplified: null,
radicalTraditional: null,
strokesSimplified: null,
strokesTraditional: null,
strokesMinRadSimplified: null,
strokesMinRadTraditional: null,
variantsSimplified: null,
variantsTraditional: null,
variants: null
}
]
*/
```
### Search for a word or character by radical
```js
let results = await cedict.searchByRadical('水')
/*
* Always returns an array of results
[
{
"id": "a1e7fdf92f84aaca2675121d4b2b54eb5122bd97",
"simplified": "水",
"traditional": "水",
"pinyin": "shui3",
"english": "surname Shui/water/river/liquid/beverage/...",
"radicalSimplified": "水",
"radicalTraditional": "水",
"strokesSimplified": 4,
"strokesTraditional": 4,
"strokesMinRadSimplified": 0,
"strokesMinRadTraditional": 0,
"variantsSimplified": null,
"variantsTraditional": null,
"variants": "氵"
},
// ...
]
*/
```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment