Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Simplest possible prototypal inheritance sugar for node and browser
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
.travis.yml
README.md
grunt.js
package.json

README.md

unterproto Build Status

Simplest possible prototypal inheritance sugar. For node.js and browser.

Installation

For node.js:

npm install unterproto

For browser you must include lib/unterproto.js into your page. Unterproto is AMD-aware so if you are using require.js you don't need to add an extra shim for it.

Usage

See live example: http://jsfiddle.net/fragphace/UCEqd/.

(function () {
  var A = Unterproto.inherits({
    initialize: function (foo) {
        this.foo = foo;
    }
  });

  var B = A.inherits({
    getFoo: function () {
        return this.foo;
    }
  });

  var b = B.instance('bar');
  alert(b.getFoo()); // 'bar'
})();

Tests

For node.js tests run:

npm test

For browser test run buster manually or try:

grunt buster
Something went wrong with that request. Please try again.