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

snacklish

v0.1.1

Published

Translator from English to Snacklish

Downloads

9

Readme

Snacklish

Now with improved flavor! Check out the demo site to handle your flavoryday translation needs.

Introduction

Snacklish is a delicious language invented for Snickers based on snack-related wordplay. This library and demo site were created to put English-to-Snacklish translations back into the mouths of the people.

If you just want to have some quick fun, use the demo site!

For your delectabusiness and enuterprise Snacklish needs, you’ll of chocourse want to caramakel use of thelicious library directly.

Why?

To prevent Snacklish from becrumbing a fed language, of course. The original Snacklish translator has been offline for far chew long. Some attempts were made to chompy it, but nuttin that I found snackceptable.

Improvements

Improved flavor, you say? Chew you havisfaction a singlelicious satisfact to snack that up?

  • 🆕 New words have been added to the lexicon, like crave, cream, crumb, and melt.
  • 💎 Updated pattern matching to prefer better substitutions.
  • 🥴 Some of the linguistically and phonetically questionable choices have been removed completely, like little → snackittle, there → treatere, yes → yumye, and more.
  • 🎲 Randomization is customizable, so you can dial down repetitive output, control the chances of substitution based on word frequency, or use a custom algorithm.

How?

Translation is based on simple pattern-based substitution rules. Automatic phonetic matching is not attempted. Check out the rules in snacklish.txt.

Installation

npm install snacklish

Usage

import { createTranslator } from "snacklish";

const translate = await createTranslator();

translate("hello, world!");
// -> "caramello, chocoworld!"

API

createTranslator

Return a function that can be used to translate a text document from English to Snacklish.

createTranslator(options: {
  getRandom: () => number;
  getProbability: ProbabilityFunction;
}): Promise<TranslatorFunction>

loadRules

Load and parse the default Snacklish ruleset. The result is a ruleset that can be used with rulesToFunction.

loadRules(): Promise<RuleSet>

loadRuleString

Load the default Snacklish document as a string from snacklish.txt.

loadRuleString(): Promise<string>

parseRules

Parse a string containing substitution rules.

parseRules(ruleString: string): RuleSet

rulesToFunction

Turn a parsed ruleset into a function that translates a single token at a time. To translate a document using this function, you will need to call it for each token and join the results.

rulesToFunction(
  rules: RuleSet;
  options: {
    getRandom: () => number;
    getProbability: (token: string) => number;
  }
): (token: string) => string

tokenize

Split a text document into tokens using the default tokenizer.

tokenize(text: string): string[]

Custom Random Source

The getRandom option can be used to provide a custom random source (for example, to supply a seeded PRNG). The default is Math.random().

Probability Functions

To customize the frequency of substitutions, you may pass a custom “probability function.” The function will be passed the original token, and must return a number. If the result of Math.random() is less than the number, the token is replaced. For example, a function that always returns 1 will always substitute; one that returns 0 will never substitute.

The following exports are included with the library to create probability functions.

getZeroProbabilityFunction

Never substitute.

getKindaProbabilityFunction

Substitute sometimes. Shorter patterns are less likely to be substituted, longer words are more likely.

getNormalProbabilityFunction

Substitute sometimes. Shorter patterns are less likely to be substituted, longer words are more likely.

getExtremeProbabilityFunction

Always substitute.

Disclaimer

This is a fan project and has no affiliation with Snickers, Mars Inc., or TBWA NY.

Snickers is a registered trademark of Mars Inc.