Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cn-chars

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cn-chars

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

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
37
increased by428.57%
Maintainers
1
Weekly downloads
 
Created
Source

cn-chars

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

build status

使用

var cnchars = require('cn-chars');

接口

toSimplifiedChar(cnChar)

转化输入的汉字cnChar为简体形式。若输入的汉字为简体形式,则输出原汉字;若输入的汉字无相应简体形式,则输出原汉字。函数只接受一个汉字的输入,多余汉字将被忽略。

toTraditionalChar(cnChar)

转化输入的汉字cnChar为繁体形式。若输入的汉字为繁体形式,则输出原汉字;若输入的汉字无相应繁体形式,则输出原汉字。函数只接受一个汉字的输入,多余汉字将被忽略。

示例

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

Keywords

FAQs

Package last updated on 23 Jul 2014

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc