0.2.4 • Published 8 years ago

nodejs-cccount v0.2.4

Weekly downloads
7
License
MIT
Repository
github
Last release
8 years ago

Ultra fast Chinese character counter

nodejs-cccount

Build Status npm version

nodejs-cccount is a Node.js module for calculating Chinese characters.

Install

$ npm i nodejs-cccount

Synopsis

Example:

var ccc = require('nodejs-cccount');

// should be 2 chars
ccc.wchars("您好Hello", function (res) {
	console.log(res); // { lengthChinese: 2 }
});

Output:

{ lengthChinese: 2 }

API

ccc.wchars(data, [options,] callback)
  • data: the article to be caculated.
  • options
  • strict: false - normal mode, true - strict mode
  • callback: the complete callback function

The callback function will be called when the data has finished calculated. The callback function will get a response object,

  • lengthChinese: the Chinese characters

Normally, you should run in normal mode for performance reason. If your article has some particular Chinese symbols, you can run in strict mode.

Use Cases of nodejs-cccount

  • Publishing platform for caculating and display Chinese characters
  • Database schema design for storing Chinese words in the JSON document
  • You want to caculate Chinese words for more exact

License

The MIT License (MIT)

0.2.4

8 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.0.1

11 years ago