@nahanil/zh-decomp

0.2.4 • Public • Published

@nahanil/zh-decomp

pipeline status coverage report NPM version

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

Readme

Keywords

Package Sidebar

Install

npm i @nahanil/zh-decomp

Weekly Downloads

0

Version

0.2.4

License

MIT

Unpacked Size

427 kB

Total Files

12

Last publish

Collaborators

  • nahanil