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 🙏

© 2025 – Pkg Stats / Ryan Hefner

wizardjs

v0.0.1

Published

Prototype-chain builder tool for JavaScript (ES5).

Readme

Wizard

Prototype-chain builder tool for JavaScript (ES5).

Wizard's source is meant to be researched in order to understand how JavaScript works. This also required the source to be relatively small.

Note: Because Wizard is meant to be a tool to help you learn the prototype-oriented behaviour and inheritance it is recommended to use it the browser where an visual/interactive console is available.

Wizard was inspired by and it is a tiny version of Troop. Large but great stuff!!!

Namespace


// AMD or CommonJS (NodeJS)
var wizard = require('wizard');

// browser
(function (wizard) {
    // do something here...
}(window.wizard));

Instantiation


Creating objects that inherit from (are build upon) wizard object

var instance = wizard.create();

Or [subClass].create([arguments]);. For inheritance see next paragraph.

Inheritance


Creating classes that inherit from (are build upon) wizard object or each other

var protoOne = wizard.extend();

Inheriting from protoOne

// notice  >>  protoOne
var protoTwo = protoOne.extend();

'Type' checking

var instance = protoTwo.create();
instance.is(protoTwo); // true
instance.is(protoOne); // true

Constructor

Wizard has a way of specifying functions that decorate a newly created object to a certain schema via the .init([initializer]).

protoOne
    .init(function (arg) {
        this.a = arg;
    }):

Instantiation

var instance = protoOne.create("some random string for value");
instance.a; // "some random string for value"

Inheritance

Note: Unless you want to extend the initializer method with custom behaviour you are not required to specify an initializer method for the derived object.

protoTwo
    .init(function () {
        protoOne.inherit(this, arguments);
    });

Adding features


There are 3 types of properties:

  • public (enumerable, mutable),
  • private (non-enumerable, mutable),
  • constant (enumerable, immutable).

creating properties

On the prototype

var protoThree = wizard.extend()

    // enumerable, immutable prototype attributes
    .constant({
        TYPE: 'protoOne'
    })

    // non-enumerable, mutable prototype attributes
    .private({
        _onClickListener: function (e) {
            // ...
        }
    })

    // public prototype interface
    .public({
        getName: function () {
            return this._name;
        }
    });

On an instance

protoThree
    .init(function () {

        // scope of the instance
        this
            // enumerable, immutable instance attributes
            .constant({
                ID: 1
            })

            // non-enumerable, mutable instance attributes
            .private({
                _name: 'me'
            })

            // public instance interface
            .public({
                greeting: 'Hello!'
            });
    });

Mixins

Mixing objects happens via the .mix([obj1 [, obj2 [, ... [, objN]]]]) method.

protoThree
    .mix({ a: 1 }, { b : 2 })

protoThree.mixes({ a: 1 }); // true