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

inheritor

v0.1.1

Published

A js inheritance library.

Readme

Inheritor Build Status NPM version

Plain and simple, Inheritor is an inheritance library that emulates the inheritance pattern of backbone extend. This library functions

Install

npm install inheritor

Usage

Inheritor uses the UMD format so there are many ways of including the libary in your projects.

Global

<script src="lib/bin/inheritor.min.js"></script>
<script>
  alert(inheritor.version);
</script>

RequireJS

define([
  'inheritor'
], function(inheritor) {
  alert(inerits.version);
});

Node / CommonJS

inheritor = require('inheritor');

After the library has been loaded, usage is pretty straight forward.

Emitter = require('events').EventEmmitter

MyEmitter = inheritor.from(Emitter, {
  someMethod: function() {
    console.log('MyEmitter Says Hi!');
  } 
});

MyEmitter.extend = inheritor.extend;

SubClassMyEmitter = MyEmitter.extend({
  someMethod: function() {
    console.log('SubClassMyEmitter Says Hi!');

    SubClassMyEmitter.__super.someMethod.call(this);
  }
});

There are a couple things to note.

  • from and extend are the same method. From takes a source as context and extends from the other provided parameters. extend uses this as its source and uses the other paramters to extend from. Adding the extend method to the MyEmitter constructor gave this context to MyEmitter.
  • __super is added to each extended constructor which directly points to the parents prototype.

Methods

from(source, [prototype [, static]])

This method will extend a source object by copying its prototype and merging it with the provided prototype. static items are added directly to the constructor and are also copied from the source and merged with the provided statics. Properties that exist in source are overwriten by properties provided.

Person = function(name) {
  this.name = name;
}

Person.prototype = {
  getName: function() {
    return this.name; 
  }
};

Employee = inheritor.from(Person, {
  work: function() {
    console.log(this.getName() + ' is doing work.');
  }
}, {
  create: function() {
    var instance = Object.create(this.prototype);

    instance.constructor.apply(instance, arguments);

    return instance
  }
});

Employee.create('bob').work(); // bob is doing work.

john = Employee.create('john');

john.instanceof Employee // true
john.instanceof Person // true

extend([prototype [, static]])

Exactly the same as from except that the source is this. This allows you to assign the method to objects and have it work directly off them instead of having to constantly use a source.

Person = function(name) {
  this.name = name;
}

Person.extend = inheritor.extend;

Person.prototype = {
  getName: function() {
    return this.name; 
  }
};

Employee = Person.extend({
  work: function() {
    console.log(this.getName() + ' is doing work.');
  }
}, {
  create: function() {
    var instance = Object.create(this.prototype);

    instance.constructor.apply(instance, arguments);

    return instance
  }
});

EmployeeSubClass = Employee.extend({
  // more stuff
});

bob = EmployeeSubClass.create('bob').work(); // bob is doing work.

john = EmployeeSubClass.create('john');

john instanceof EmployeeSubClass // true
john instanceof Employee // true
john instanceof Person // true

Building

To build the project checkout out the repository and simply use npm install and gulp.

npm install
gulp

Links

Changelog
License