Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
contains-chinese
Advanced tools
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.
const containsChinese = require('contains-chinese');
let t = containsChinese('香港 is cool'); // true
let f = containsChinese('홍콩'); // false - not Chinese
This package provides a way to check whether a string contains any Chinese
text. The function will return true
if there is at least one Chinese
character in the string.
is-chinese
Another package called is-chinese
will return false if the string contains
at least one non-Chinese character, for example Welcome to 香港
will
result in false
.
In contrast, this package will return true
for such text containing mixed
Chinese and non-Chinese text.
containsChinese
- returns true
if the string has any Chinese characters.containsChinese.HAN_REGEX
- contains the regex used for this check.If you have any comments, contact me here: https://github.com/catcher-in-the-try/
FAQs
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.
We found that contains-chinese demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.