Advanced username analysis library with security scoring, Unicode script detection, homoglyph spoofing prevention, and bot detection β zero regex magic.
- π Unicode Script Detection β identifies scripts from 100+ languages (Latin, Cyrillic, Arabic, Hangul, Devanagari, etc.)
- π‘οΈ Spoofing Prevention β detects homoglyph attacks (Cyrillic
Π°vs Latina) and invisible characters - π€ Bot & Spam Detection β Shannon entropy analysis catches random keystrokes (
xcv892nm) - π§ Smart Classification β categorizes as Personal, Gamer, Corporate, Bot, Leet, and more
- π Quality Scoring β 0β100 scores for readability and security risk
- π Leet Speak Normalization β
h4ck3rβhacker, mathematical font stripping - β‘ Batch Analysis β analyze hundreds of usernames with built-in LRU cache
- πͺΆ Zero Dependencies β lightweight, tree-shakeable ESM + CJS builds
npm install @fazelstudio/username-intelligenceimport { analyzeUsername } from '@fazelstudio/username-intelligence';
const result = analyzeUsername('h4ck3r_man');
console.log(result.isValid); // true
console.log(result.classification); // "Gamer"
console.log(result.security.risk_level); // "LOW"{
"username": "h4ck3r_man",
"score": 85,
"classification": "Gamer",
"isValid": true,
"flags": ["leet_speak"],
"security": {
"risk_level": "LOW",
"is_spoofing": false,
"has_hidden_chars": false
},
"metadata": {
"script": "Latin",
"entropy": 2.5
}
}const result = analyzeUsername('admin_support', {
strict: true,
blockProfanity: true,
reservedWords: ['admin', 'support', 'mod'],
checkVisual: true,
});import { batchAnalyze } from '@fazelstudio/username-intelligence';
const results = batchAnalyze(['john_doe', 'xX_gamer_Xx', 'admin']);
results.forEach(r => {
console.log(`${r.username}: ${r.analysis.classification.style} (score: ${r.analysis.classification.scores.quality})`);
});| Function | Description |
|---|---|
analyzeUsername(username, options?) |
Analyze a single username |
batchAnalyze(usernames, options?) |
Analyze multiple usernames |
clearCache() |
Clear the LRU analysis cache |
getCacheStats() |
Get cache hit/miss statistics |
| Option | Type | Default | Description |
|---|---|---|---|
strict |
boolean |
false |
Enable stricter validation rules |
blockProfanity |
boolean |
false |
Reject usernames containing profanity |
reservedWords |
string[] |
[] |
Custom blocked words |
checkVisual |
boolean |
true |
Check for visual spoofing |
enableCache |
boolean |
true |
Enable LRU result caching |
enableSecurity |
boolean |
true |
Enable security analysis |
enableLinguistic |
boolean |
true |
Enable linguistic analysis |
enableVisual |
boolean |
true |
Enable visual analysis |
- Registration Security β block spoofed usernames during sign-up
- Spam Prevention β detect bot-generated random usernames
- Brand Protection β catch impersonation attempts (e.g.
ΡΠ°ΡΡΠ°lwith Cyrillic chars) - UX Gamification β score username quality during onboarding
- Moderation β filter profanity and reserved words
npm install
npm run build
node test-optimization.js
npm run formatMIT β Β© 2026 Fazel
username-intelligence β Know who's behind the name.