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

reformer

v1.4.2

Published

Super customizable, Self-contained, self-rendering, self-validating forms that can only output valid data.

Readme

#reformer

Self-contained, self-rendering, self-validating forms that can only output valid data.

##Step #1: Define your fields, with as many tests as you want for each field:

var f = new Reformer({
  fields: [
    {
      name: 'first_name',
      label: 'First Name',
      placeholder: 'Something',
      required: true
    },
    {
      name: 'last_name',
      label: 'Last Name',
      tests: [
        {
          test: function (val) {
            return false;
          },
          message: 'something will always go wrong'
        },
        {
          test: function (val) {
            return val && val.toString().length > 2;
          },
          message: 'Must be at least three characters.'
        }
      ],
      required: true
    }
  ],
  submit: function (vals) {
    console.log(vals);
  },
  error: function (vals) {
    console.log('error', vals);
  }
});

##Step #2: Render it once. It handles itself after that:

document.addEventListener('DOMContentLoaded', function () {
  document.querySelector('#something').appendChild(f.render());
});

reformer will handle form submit, and call your callback if everything's happy.

##Bonus Step #3: Asynchronous validation

You know how you've always got that one field that needs to be checked via ajax. It's a pain. Because most of your tests are simple regexes that can be run synchronously except for this one stupid ajax call to check if a username is available. So, just do this:

// your field definition
{
  name: 'email',
  label: 'Email',
  tests: [
    // BAM! add the `async` flag and your test will receive a third argument. A callback.
    {
      async: true, 
      test: function (email, formInstance, cb) {
        $.get('/email-is-avail?val=' + email, function (data) {
          cb(data === '1');
        });
      },
      message: 'This email is already in use.'
    },
    // You can have simple synchronous tests alongside as well.
    // and it still Just Works™
    {
      test: _.isEmail,
      message: 'This doesn\'t seem like a real email address'
    }
  ],
  required: true
}

It's simple, but that's all for now. Because it works for what I need for this particular app. Contributions welcomed.

Cheers,

- @HenrikJoreteg

##Gotchas

  • Still needs a bit more work/polish/testing.
  • Requires IE8 or newer because I didn't want jQuery as a dependency.
  • Won't really work with checkboxes/radioboxes and such, just yet.

##License

MIT