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

xmix

v0.0.1

Published

A pack of mixin related utility methods

Readme

Xmix

Xmix is a pack of mixin related utility methods, which will let you create, and apply custom mixins, by injecting them into the prototype chain.

Example

import mixin from 'xmix';

const Mixin = mixin.new(Class => class extends Class {
  constructor() {
    super();

    this.mixinProperty = 'comes second';
  }
});

class Parent {
  constructor() {
    this.parentProperty = 'comes first';
  }
}

class Child extends mixin(Mixin)(Parent) {
  constructor() {
    super();

    this.childProperty = 'comes last'
  }
}

const child = new Child();

assert(mixin.of(child, Mixin) == true);

API

mixin(Function, [...Function]) function

description: Takes a single mixin (or more) and returns a function which applies the mixins in series once invoked. This function can extend an additional extra class by simply invoking it with the desired class, or we can either skip that stage and call the .class property.

returns: extend(Function) function

usage:

class Child extends mixin(A, B)(Parent) {

}

or without providing an additional class:

class Child extends mixin(A, B).class {

}

mixin.new(Function, [Function]) function

description: Takes a factory function which should return a child class of the provided parent class. An additional transformation function may be provided as the second argument for syntactic sugar.

returns: mixin(Function) function

usage:

const Mixin = mixin.new(Class => class extends Class {

});

Then, the mixin can either be applied using the following methods:

class Child extends mixin(Mixin)(Parent) {}
// or
class Child extends Mixin(Parent) {}
// or in case we're not interested in Parent class
class Child extends Mixin.class {}

An additional transformation function may be provided as well:

const Mixin = mixin.new(Class => class extends Class {

}, (Child, Parent) => {
  Object.defineProperty(Child, 'name', {
    enumerable: true,
    configurable: true,
    value: Parent.name
  });
});

mixin.of(Object, Function) function

description: Checks if a given instance is affected by a given mixin.

returns: Boolean

usage

mixin.of(instance, Mixin);

Download

The source is available for download from GitHub. Alternatively, you can install using Node Package Manager (npm):

npm install xmix

License

MIT