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

mithril-mu

v1.0.1

Published

µ is an unobtrusive, lightweight function wrapper around mithril's `m()` function.

Readme

µ (mu)

µ is an unobtrusive, lightweight function wrapper around mithril's (v1.*) m() function.

µ() is a drop-in replacement for m() adding support for custom attribute transformations (similar to Barney Carroll's mattr).

Install:

npm install mithril-mu

Usage:

var m = require('mithril');
var µ = require('mithril-mu')(m, myAttrTransforms);
console.log( µ.attrs === myAttrTransforms ); // true

// ... then use `µ()` in place of `m()` where super-powers are needed.

Adding transformations:

// Post-hoc addition
µ.attrs.alertOnClick = function (vnode, attrValue, attrs) {
    var onclick = attrs.onclick;
    attrs.onclick = function (e) {
        if (onclick) { onclick.call(this, e); }
        alert( attrValue );
        e.preventDefault();
    };
    console.log( attrs === attrs ); // -> true
  };
// (https://www.npmjs.com/package/m.attrs.bidi)
µ.attrs.bidival = require('m.attrs.bidi');

...Then in your views:

var myView = function ( ctrl ) {
    return µ('div.box', {
            alertOnClick: 'Hello World!',
            onclick: function (e) { alert('Hi all!'); }
        }, [
            'Foobar enhanced element',
            m('p', 'Normal mithril too'),
            µ('input' { bidival:ctrl.inputText })
        ]);
};

In which div.box will alert first 'Hi all!' and then 'Hello World!' when clicked, and the <input> will automatically show the value ctrl.inputText, and update it on input.

Notes:

  1. The transformed attribute is removed from the virtual node's attrs map to keep the rendered DOM as clean as possible. If you do want the attribute to appear in the DOM, you must explicitly add it back to the attrs object – like so:

    µ.attrs.onclick = function (vnode, handler, attrs) {
        // log all onclick handlers
        console.log( 'binding', handler, ' to ', vnode );
        attrs.onclick = handler;
    }
  2. A Transformation function may return a value other than undefined, which instantly replaces the original virtual node, and no further processing is performed. (See discussion.) Thus you should avoid writing transformations that cause immediate side-effects outside the virtual-node itself or its attrs, as the original virtual-node might never land in the DOM, or have it's onremove called.

Utilities:

  • µ.transform( vnode ) Performs post-hoc attr transformation on an existing vnode.

    var vanillaVnode = m('p', { ontransitionend:myFunc }, 'Content');
    var shinyVnode = µ.transform( vanillaVnode );