@nahanil/zh-decomp
v0.2.4
Published
Decompose Chinese characters
Downloads
2
Readme
@nahanil/zh-decomp
Decompose Chinese characters
npm install --save @nahanil/zh-decomp
const decomp = require('@nahanil/zh-decomp')
lookup(char)
let res = decomp.lookup('蟆');
/*
{
"label": "蟆",
"children": [
{
"label": "虫"
},
{
"label": "莫",
"children": [
{
"label": "艹"
},
{
"label": "旲",
"children": [
{
"label": "日"
},
{
"label": "大"
}
]
}
]
}
]
}
*/
radical(char)
This will likely be removed in future in favour of @nahanil/bushou
decomp.radical('蟆')
// '虫' <-- Found radical
decomp.radical('虫')
// '*' <-- 虫 is a radical
decomp.radical('U')
// null <-- 'U' not found
Source
https://commons.wikimedia.org/wiki/Commons:Chinese_characters_decomposition