UNPKG
@writ/utils
Version:
latest (2.0.0)
2.0.0
1.1.3
1.1.2
1.1.1
1.1.0
1.0.9
1.0.8
1.0.7
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
0.0.1
0.0.0
My tool kit
github.com/tianlugang/utils
tianlugang/utils
@writ/utils
/
cn-has.js
12 lines
(10 loc)
•
322 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
const
getPunctuationRegex =
require
(
'./cn-punctuation-regex'
);
/** * 校验是否包含中文字符(包括中文标点符号) *
@param
{
string
} str *
@returns
{
boolean
} */
function
hasCNChars
(
str
) {
return
/[\u4e00-\u9fa5]/
.
test
(str) ||
getPunctuationRegex
().
test
(str); }
module
.
exports
= hasCNChars;