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

typogly

v1.0.2

Published

A lightweight JavaScript/TypeScript library that scrambles text using the typoglycemia effect — keeping it readable while shuffling middle letters

Readme

Typogly

npm version npm downloads License: MIT

A lightweight JavaScript/TypeScript library that transforms text using the typoglycemia effect — scrambling the middle letters of words while keeping them surprisingly readable!

Based on the fascinating phenomenon where text remains readable when only the first and last letters of each word are preserved, even when the middle letters are scrambled.

scramble("According to research at Cambridge University...")
// "Acncdoirg to rseearch at Cbamirdge Uinvesrtiy..."

✨ Features

  • 🎯 Simple API - One function to scramble, easy to use
  • 🎲 Seeded randomness - Reproducible results when needed
  • 🔤 Smart word detection - Handles punctuation, capitalization, and Unicode
  • ⚙️ Configurable - Control minimum word length, scrambling probability, and more
  • 📦 Zero dependencies - Lightweight and fast
  • 🎭 TypeScript native - Full type safety included
  • 🌳 Tree-shakeable - ESM and CommonJS support

📦 Installation

# npm
npm install typogly

# yarn
yarn add typogly

# pnpm
pnpm add typogly

🚀 Quick Start

import { scramble } from 'typogly';

const text = "Hello world! This is amazing.";
console.log(scramble(text));
// Example output: "Hlelo wlord! Tihs is amzanig."

📖 API

scramble(text, options?)

Scrambles text using the typoglycemia effect.

Parameters

  • text (string): The text to scramble
  • options (object, optional): Configuration options

Options

interface TypoglyOptions {
  minLength?: number;              // Minimum word length to scramble (default: 4)
  seed?: number;                   // Random seed for reproducible results
  preserveCase?: boolean;          // Preserve letter casing (default: true)
  scrambleProbability?: number;    // Probability of scrambling each word 0-1 (default: 1)
}

Examples

Basic usage:

import { scramble } from 'typogly';

console.log(scramble("Hello world"));
// "Hlelo wlrod" (randomized each time)

Reproducible with seed:

console.log(scramble("The quick brown fox jumps over the lazy dog multiple times"));
// Random output: "Tqhe kciuq bworn fox jmups oevr teh lzay dog mlutiple tmi es"

console.log(scramble("The quick brown fox jumps over the lazy dog multiple times", { seed: 42 }));
// Always produces the same output: "Teh qcuik bworn fox jmups oevr teh lzay dog mlutiple times"
console.log(scramble("The quick brown fox jumps over the lazy dog multiple times", { seed: 42 }));
// Same output again: "Teh qcuik bworn fox jmups oevr teh lzay dog mlutiple times"

Only scramble longer words:

console.log(scramble("I am extremely happy today because of success", { minLength: 6 }));
// Random output: "I am etremxely happy today bcause of sseccus"
// (only words with 6+ letters are scrambled: "extremely", "because", "success")

Partial scrambling:

console.log(scramble("The quick brown fox jumps", { scrambleProbability: 0.5, seed: 42 }));
// Example output: "The quick brown fox jpmus"
// Randomly scrambles about 50% of eligible words

Preserve original casing:

console.log(scramble("HELLO World", { preserveCase: true }));
// "HLELO Wlrod"

createScrambler(defaultOptions?)

Creates a scrambler function with preset options.

import { createScrambler } from 'typogly';

// Create a scrambler with preset options
const myScrambler = createScrambler({ seed: 42, minLength: 5 });

// Use with preset options
console.log(myScrambler("Hello world"));
// "Hlelo wlord"

// Override specific options
console.log(myScrambler("Hello world", { minLength: 3 }));
// "Hlelo wlord" (scrambles more words)

🌐 Browser and Node.js Support

Works in all modern browsers and Node.js 18+.

ES Modules

import { scramble } from 'typogly';

CommonJS

const { scramble } = require('typogly');

📚 Advanced Examples

Scramble a full paragraph:

const paragraph = `According to research at Cambridge University, it doesn't 
matter in what order the letters in a word are, the only important thing is 
that the first and last letter be in the right place.`;

console.log(scramble(paragraph, { seed: 42 }));
// Example output: "Aoccrding to rseearch at Cbamirdge Uinvesrtiy, it doesn't 
// mtater in what oredr the lteetrs in a word are, the only ipmorantt thing is 
// that the fsrit and last lteetr be in the rhgit plcae."

Create a consistent scrambler for your app:

const appScrambler = createScrambler({
  seed: 12345,
  minLength: 5,
  scrambleProbability: 0.8
});

console.log(appScrambler("Welcome to our amazing website"));
// "Wleocme to our amzanig wbesite"

console.log(appScrambler("This is some interesting content"));
// "Tihs is smoe itnretseing conetnt"

Gradual scrambling effect:

function gradualScramble(text: string, steps: number = 5) {
  const results = [];
  for (let i = 0; i <= steps; i++) {
    const probability = i / steps;
    results.push(scramble(text, { 
      scrambleProbability: probability,
      seed: 42 
    }));
  }
  return results;
}

const effect = gradualScramble("The quick brown fox jumps over the lazy dog");
console.log(effect);
// [
// "The quick brown fox jumps over the lazy dog",
// "The qciuk brwon fox jumps over the lzay dog",
// "The qciuk bwron fox jmups over the lzay dog",
// "The qciuk bwron fox jmups oevr the lzay dog",
// "The qciuk bwron fox jmups oevr the lzay dog",
// "The qciuk bwron fox jmups oevr the lzay dog"
// ]

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

MIT © Pawel Stalowczyk

🔗 Links