# cn-chars

> 一个对简体和繁体汉字相互转化的Node.js模块

Latest version **0.1.1** (published 2014-07-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install cn-chars
pnpm add cn-chars
yarn add cn-chars
bun add cn-chars
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2014-07-23 |
| First published | 2014-07-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | Shuping LIU |
| Maintainers | liushuping |
| Keywords | 简体, 繁体, 汉字, cn, node, javascript, character |

## Links

- npm: https://www.npmjs.com/package/cn-chars
- Repository: https://github.com/liushuping/cn-chars
- Issues: https://github.com/liushuping/cn-chars/issues
- npm.io page: https://npm.io/package/cn-chars

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2014-07-23
- 0.1.0 — 2014-07-23
- 0.0.2 — 2014-07-20
- 0.0.1 — 2014-07-20

## README

cn-chars
========

一个对简体和繁体汉字相互转化的Node.js模块

[![build status](https://travis-ci.org/liushuping/cn-chars.svg)](https://travis-ci.org/liushuping/cn-chars.svg)

## 使用
```javascript
var cnchars = require('cn-chars');
```
## 接口
**toSimplifiedChar(cnChar)**

转化输入的汉字`cnChar`为简体形式。若输入的汉字为简体形式，则输出原汉字；若输入的汉字无相应简体形式，则输出原汉字。函数只接受一个汉字的输入，多余汉字将被忽略。

**toTraditionalChar(cnChar)**

转化输入的汉字`cnChar`为繁体形式。若输入的汉字为繁体形式，则输出原汉字；若输入的汉字无相应繁体形式，则输出原汉字。函数只接受一个汉字的输入，多余汉字将被忽略。
## 示例
```javascript
var cnchars = require('cn-chars');
var cnChar = '话';
var result = cnchars.toTraditionalChar(cnChar);
console.log(result); // output: 話

cnChar = '鐘';
result = cnchars.toSimplifiedChar(cnChar);
console.log(result); //output: 钟
```

## Test
Make sure `mocha` is installed globally

```
npm install mocha -g
```
Run `npm test` to run unit test

## License
MIT

---
_Source: https://npm.io/package/cn-chars · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
