Advanced prototype chain

This example shows advanced manipulation of the prototype chain.


var create = require("mu-create/create");
var construct = require("mu-create/constructor");
var proto = require("mu-create/prototype");
var i = 0;

var P = function () {};
P.prototype.base = ++i;

var C = create(construct, proto)(function() {
  this.instance = ++i;
}, {
  "prototype": function(c) {
    return Object.defineProperty(new P(), "constructor", {
      "value": c
    });
  }
}, {
  "component": ++i
}, {
  "prototype": function(c) {
    return Object.create(c.prototype);
  }
}, {
  "inject": ++i
});

var c = new C();