Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

js-han

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-han

簡化字轉漢字,js實現

latest
Source
npmnpm
Version
0.0.13
Version published
Maintainers
1
Created
Source

簡化字轉漢字

簡化字轉漢字,js實現

  • 支持《通用規範漢字表》中的全部簡化字
  • 對於一對多的簡化字,人工標註規則
  • 支持運行時增加自定義規則
  • 簡單快速

doc

npm

js

python

rust

使用

node

install

npm i js-han@latest

package.json

{
  "type": "module",
  "dependencies": {
    "js-han": "^0.0.10"
  }
}

example

import Han from 'js-han'

const hanInstance = Han.getInstance()

// 蘿蔔
console.log(hanInstance.toTraditional('萝卜'))

// 胡卜
console.log(hanInstance.toTraditional('胡卜'))

// 胡蔔
hanInstance.addRule('卜,蔔,-1|0|胡')
console.log(hanInstance.toTraditional('胡卜'))

const han = new Han()

// 頭髮
console.log(han.toTraditional('头发'))

browser

<!DOCTYPE html>
<html lang="zh-Hans">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>簡化字轉漢字</title>
    <script type="module">
        import Han from "https://lizongying.github.io/js-han/han.min.js";
        const hanInstance = Han.getInstance();
        console.log(hanInstance.toTraditional('汉字'));
    </script>
</head>
<body>
</body>
</html>

讚賞

image

Keywords

漢字

FAQs

Package last updated on 23 Apr 2025

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