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

mitto

v0.3.1

Published

A small library that lets you search for and specify configurations that should be present in other projects when your package is used.

Readme

#mitto

mitto is a small library that helps package creators search the file directory of the application consuming their package for its relevant config.

Package creators can even drop a .mitto file into their root folder and specify required and optional parameters with type-checking (including descriptive error messages for package consumers if a required parameter is not present or is of the wrong type).

Reasons to use mitto:
  • Quick and painless to start writing your package with a user-provided config in mind
  • required or optional parameter enforcement with type-checking for your configs
  • Descriptive error messages for the user when something is misconfigured
  • .mitto gives your package consumers a common area to see what configurations are available and/or expected

Installation

npm install mitto --save

Usage

Using mitto as a simple file/config finder without a .mitto file

    var mitto = require('mitto');

    var myConfig = mitto.loadConfig('config_i_need.json');

    if (myConfig) {
        //DO STUFF
    } else {
        //YELL AT USER AND CONFIGURE THINGS MYSELF
    }

Using mitto for type-checked configuration expression with a .mitto file

Create a .mitto config file in your root folder:

{
    "name" : "name_of_the_config_file_you_expect_the_user_to_provide.json",
    "required" : {
        "areWeHavingFun" : {
            "type" : "boolean",   //valid types: "undefined", "object", "boolean", "number", "string", "symbol", "function"
            "description" : "boolean that represents if we're having fun" // **Optional**, you don't have to include "description"
        },
        "maximumBeerCount" : {
            "type" : "number"
        } 
    },
    "optional" : {
        "partyResponsibly" : {
            "type" : "boolean",
            "description" : "boolean indicating if we should party responsibly",
            "default" : false // **Optional**, the default value if the user doesn't provide a value or doesn't have a configuration at all
        }
    }
}

The code we write will be exactly the same, except anything we get from the user will be compared with your .mitto and type-checked:

    var mitto = require('mitto');

    var myConfig = mitto.loadConfig('config_i_need.json');

    if (myConfig) {
        //DO STUFF
    } else {
        //CONFIGURE THINGS MYSELF
    }

Error Handling

.mitto has required attributes? | User has a configuration file? | Error handling behavior :---------------------------------: | :----------------------------: | :---------------------- Yes | Yes | Only throws errors if user is missing a required parameter or has a parameter of an invalid type. Yes | No | Throws an error that the configuration is missing. No | Yes | Does not throw errors. loadConfig() will return NULL or an object with defaults. No | No | Does not throw errors. loadConfig() will return NULL or an object with defaults.

Tests

npm test

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

Release History

  • 0.3.0 Unified API under loadConfig. mitto now "requires" the object for you. .mitto is now more explicit and detailed.
  • 0.2.0 Switch from object-templating to .mitto templating, separate opinionated call from non-opiniated.
  • 0.1.0 Initial release