UNPKG

retard-npm

Version:

43 lines (42 loc) 1.17 kB
export function isBozo(name) { const reasons = [ "Still uses var in 2025", "Thinks semicolons are optional (they are, but... no)", "Uses ChatGPT to write 'console.log(\"hello world\")'" ]; if (!name || name.trim().length === 0) { return { status: false, confidence: "0%", reason: "No name provided", verdict: "Not a Bozo (but also not a person)" }; } const length = name.trim().length; let confidence; let reason; let status = true; let verdict = "Certified Bozo 💀"; if (length <= 3) { confidence = "95%"; reason = "Name is suspiciously short"; } else if (length > 15) { confidence = "90%"; reason = "Name is way too long"; } else if (length >= 7 && length <= 10) { confidence = "70%"; reason = "Name is average, but still sus"; } else { confidence = `${Math.floor(Math.random() * 20) + 60}%`; reason = reasons[Math.floor(Math.random() * reasons.length)]; } return { status, confidence, reason, verdict }; }