UNPKG

contains-chinese

Version:

Checks whether the input string contains any Chinese text (at least one character). Works with Traditional and Simplified. Unlike the is-chinese package, returns `true` even if the string contains mixed Chinese and non-Chinese characters.

5 lines (4 loc) 247 B
const containsChinese = require('./index'); console.log(`香港 is cool = ${containsChinese('香港 is cool')}`); // true console.log(`홍콩 = ${containsChinese('홍콩')}`); // false console.log(containsChinese.HAN_REGEX); // print regex