https://github.com/jollen/cccount
Ultra fast Chinese character counter
https://github.com/jollen/cccount
Last synced: about 1 year ago
JSON representation
Ultra fast Chinese character counter
- Host: GitHub
- URL: https://github.com/jollen/cccount
- Owner: jollen
- License: mit
- Created: 2013-09-13T10:06:59.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2016-07-11T09:37:21.000Z (almost 10 years ago)
- Last Synced: 2025-03-24T17:02:19.481Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 200 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Ultra fast Chinese character counter
cccount
=======
[](https://travis-ci.org/jollen/cccount)
[](https://www.npmjs.com/package/cccount)
**cccount** is a Node.js module for calculating Chinese characters.
# Install
```
$ npm i cccount
```
# Synopsis
Example:
```
var ccc = require('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 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)