1
0
Fork
You've already forked hanalyzer
0
Detect if a string contains traditional or simplified Chinese characters. https://www.npmjs.com/package/hanalyzer
  • TypeScript 100%
Find a file
2026年01月23日 12:18:10 +07:00
src Simplify the logic, use a worse name 2026年01月23日 12:18:10 +07:00
.gitignore initial commit 2026年01月22日 19:54:51 +07:00
bun.lock initial commit 2026年01月22日 19:54:51 +07:00
bunup.config.ts initial commit 2026年01月22日 19:54:51 +07:00
LICENSE initial commit 2026年01月22日 19:54:51 +07:00
package.json Simplify the logic, use a worse name 2026年01月23日 12:18:10 +07:00
README.md Simplify the logic, use a worse name 2026年01月23日 12:18:10 +07:00
tsconfig.json initial commit 2026年01月22日 19:54:51 +07:00

hanalyzer

Detect if a string contains Simplified or Traditional Chinese characters. It’s a bad pun, I know.

Installation & usage

npm install hanalyzer
import { detect } from "hanalyzer";
detect("無需帳戶或註冊。");
// => "traditional"

detect("无需注册或设置");
// => "simplified"

detect("hello?");
// => null
import { hasSimplifiedChars } from "hanalyzer";
hasSimplifiedChars("無需帳戶或註冊。");
// => false

hasSimplifiedChars("無需帳戶或註冊。But also simplified right here: 无");
// => true

Prior art

Loosely based on traditional-or-simplified by @nickdrewe.