UNPKG

@writ/utils

Version:
12 lines (10 loc) 322 B
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;