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 🙏

© 2025 – Pkg Stats / Ryan Hefner

spelly

v1.0.2

Published

pure javascript spellcheck that learns

Readme

Spelly

Build Status

Pure JavaScript spellchecker that learns as you use it 1

Installation

npm install spelly

Usage

Get suggestions

const Spelly = require("spelly");

let options = {
  cache: {
    type: "configstore",
    store: new Configstore("foo")
    // optional, defaults to internal Configstore instance under "spelly"
  }
};

const spelly = new Spelly("/usr/share/dict/words", options);

let suggestions = spelly.check("wierd");

/**
 * {
 *   original: "wierd",
 *   suggestions: [{
 *     word: "wired",
 *     score: 5
 *   }, {
 *     word: "weird",
 *     score: 5
 *   }, {
 *     word: "wield",
 *     score: 4
 *   }]
 * }
 */

Results will be cached in the chosen store, making Spelly smarter and faster each time it is used.

Managing your own cache

You can manage your own cache of words by adding/removing them to/from the store. When adding a word, all suggestions beneath its score will be shifted down 1. (e.g. a score of 4 goes to 3). If the suggestion already exists, it will be moved appropriately according to the score given.


// add 'wired' with score '1' or move it to the bottom position
spelly.cache("weird", { word: "wired", score: 1 });

// remove a suggestion for a misspelling
spelly.clearCache("somthing", "something");

// remove all suggestions for a misspelling
spelly.clearCache("somthing");

// clear all cache
spelly.clearCache();


// retrieve cached suggestions for a misspelling
spelly.getCache("somthing");

// retrieve all cached suggestions
spelly.getCache();

Feeling lucky?

Grab the first suggestion out of the list

let suggestion = spelly.first("wierd");

/**
 *{
 *  original: "wierd",
 *  suggestion: {
 *    word: "weird",
 *    score: 5
 *  }
 *}
 */

Learning

Spelly uses configstore by default for the suggestion cache, helping make it both fast and smart. Each time a misspelled word is given to Spelly, it finds it in the store, or generates a suggestion, then adds it to the store.

API

Spelly(dictionary, options)

Spelly constructor.

  • dictionary Type: Array|String An array of words or path to a file containing a newline separated list of words.

  • options.cache Type: Object Spelly cache options.

    • cache.type Type: String Cache type (configstore).
    • cache.store Type: Object configstore instance (optional) for configstore.

check(word)

Spellcheck a word. returns a promise with the suggestions Object.

  • word: Type: String The word to spellcheck.

cache(misspelledWord, suggestion)

Add a suggestion to a mispelled word.

  • misspelledWord Type: String The misspelled word to cache.
  • suggestion Type: Object
    • suggestion.word Type: String The suggestion to add for the misspelled word.
    • suggestion.score Type: Number Score the suggestion. If the suggestion exists for the word, it will be re-scored based on the given score and all others below will be shifted down (or up depending on how you look at it) by 1.

clearCache([misspelledWord][,suggestion])

Clear the cache of a single suggestion, multiple suggestions or all suggestions.

  • missppelledWord Type: String(optional) The misspelled word to clear.
  • suggestion Type: String(optional) the suggestion to remove from the misspelled word.

getCache([misspelledWord])

Retrieve the cache for a mispelled word or all words.

  • misspelledWord Type: String(optional) The misspelled word to retrieve cache for.

first(misspelledWord)

Retrieve the first suggestion for a mispelled word

License

See LICENSE