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

mr-error

v0.7.3

Published

Build and handle errors in the way they deserve.

Readme

Mr.Error

Node.js CI Tests

The right way to bake errors.

Introduction

Errors building is one of the most common tasks in software development. Mr.Error gladly provides high-quality service to help your application cover all needs in this field.

Make errors your friends🤝 , not your enemies.

Installation

Just one step.

npm i mr-error

And use it where you need it.

import { MrError } from 'mr-error';

Overview

This section explains how to generate, merge and even localize errors.

Have a look at 🐨 Mr.Koa boilerplate and 💼 Mr.UseCase package if you want to see Mr.Error in ready-to-use environment.

Generation

Let's create an instance and add a few errors:

const instance = new MrError();

instance.add('email', 'format');
instance.add('password', 'length');
instance.add('password', 'length');
instance.add('password', 'security');

instance.errors; // => { email: ['format'], password: ['length', 'security'] }

As you see, Mr.Error is doing its work pretty well. It groups these errors and removes duplicates.

Merge

Now let's assume that we need to collect errors from different instances.

const instanceFirst = new MrError();
const instanceSecond = new MrError();

instanceFirst.add('email', 'format');
instanceSecond.add('password', 'length');
instanceFirst.merge(instanceSecond);

instanceFirst.errors; // => { email: ['format'], password: ['length'] }

It seems that Mr.Error doesn't even break a sweat.

Localization

The localization feature is enabled with the help of the i18n package.

import i18n from 'i18n';

i18n.configure({
  locales: ['en'],
  directory: `${__dirname}/locales`,
  objectNotation: true,
  updateFiles: false,
  defaultLocale: 'en',
  staticCatalog: {
    en: require(`${__dirname}/locales/en`),
  },
});

class MrErrorLocalized extends MrError {
  protected localizationPackage = i18n;
}

Where locales/en/index.js contains:

module.exports = {
  test: {
    text: {
      length: 'The text should be at least {{min}} characters long.',
    },
  },
};

Now we can utilise all localization power of i18n under Mr.Error hood. So, let's localize something.

const instance = new MrErrorLocalized({ localePath: 'test' }); // default 'base'

instanceFirst.add('text', 'length', { replacements: { min: 10 } });

instance.messages(); // => { text: ['The text should be at least 10 characters long.'] }

As you may notice, Mr.Error not only perfectly localizes the error, but passes some information to localization data as well.

Conclusion

Mr.Error is ready to take the role of error builder and has a simple interface to work with.

Give it a try!