npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

keyboard-mash

v0.1.0

Published

Detect keyboard-mashed gibberish input like "asdf", "qwerty", or "sdkjfhsdf" in names and form fields. Zero dependencies, TypeScript-first.

Readme

keyboard-mash

Detect keyboard-mashed gibberish — asdf, qwerty, sdkjfhsdf, aaaa — in names, signup forms, and lead data, in JavaScript, TypeScript, and Node.js.

  • Zero dependencies, tiny, tree-shakeable
  • TypeScript-first with full type definitions
  • Tuned against real words that fool naive checks (retro, sassy, mama, couscous)
  • Works in Node, browsers, and edge runtimes

Install

npm install keyboard-mash

Detect gibberish input

import { isMash, mashScore, analyzeMash } from "keyboard-mash";

isMash("asdf");        // true
isMash("sdkjfhsdf");   // true
isMash("John Smith");  // false
isMash("Salman");      // false

analyzeMash("asdfasdf");
// { mash: true, score: 0.8, signals: ["adjacent-keys"] }

analyzeMash("Jane Smith");
// { mash: false, score: 0, signals: [] }

Any mashed word marks the whole input, so "John asdfasdf" is flagged.

Scores and thresholds

mashScore returns 0 (clean) to 1 (certain mash). isMash flags input at 0.7 by default; pass your own threshold to be stricter or more lenient:

mashScore("qwe");        // 0.6 — suspicious, but too short to be sure
isMash("qwe");           // false at the default threshold
isMash("qwe", 0.5);      // true — stricter

What it looks for

| Signal | Example | | --- | --- | | keyboard-run | 4+ keys in order along a keyboard row: asdf, qwerty, lkjhgf | | repeated-pattern | one unit repeated 3+ times: ababab, aaaa | | character-repetition | one character dominating: aaaab | | adjacent-keys | nearly every keypress next to the previous one: asdsa | | no-vowels | 5+ letters, no vowel: sdkjfhsdf | | low-variety | long input, few distinct characters: aabbaabb |

Why not just a regex?

A blocklist (asdf, qwerty, test) misses everything it hasn't seen: reversed runs (lkjhgf), repeats (asdfasdf), and random consonant mashes (sdkjfhsdf). Scoring the mechanics of mashing — key adjacency, repetition, character variety — catches those while letting sassy, mama, liberty, and Mississippi through. The heuristics flag 4 of the 236k words in the English dictionary (0.002%), and the test suite pins the near-misses down.

Limitations

Latin letters and digits only — input in other scripts (اردو, кириллица) is never flagged. Strings under 3 characters are too short to judge and score 0.

API

| Function | Returns | | --- | --- | | isMash(input, threshold?) | boolean (default threshold 0.7) | | mashScore(input) | number from 0 to 1 | | analyzeMash(input) | { mash, score, signals } |

License

MIT