0.1.1 • Published 5 years ago
test-chinese v0.1.1
test-chinese
A tool to test whether a string is chinese (in)completely
Installation
$ npm install --save test-chinese
Api
/**
* 测试字符串是否(完全)是中文,其中空格换行符等会被忽略
* @param {string} content 传入字符串
* @param {boolean} complete 是否完全检查,不传默认为false
* @return {boolean} 判断结果
*/
testChinese(content,complete);
Usage
const testChinese = require("test-chinese");
console.log(testChinese("张翔宇捞的一",true)); // true
console.log(testChinese("张翔宇x捞的一",true)); // false
console.log(testChinese("zhangxiangyu捞deyi",false)); // true
console.log(testChinese("张翔宇lao的一")); // true
License
MIT © oGsLP