inherit

origin inherit from node util BUT super called like "super"

inherit(ctor: Function, superCtor: Function): Function
Parameters
ctor (Function) constructor to extend
superCtor (Function) constructor which will be installed as "super"
Returns
Function: constructor
Example
var inherit = require('s-inherit');
var DecoratedClass = inherit(Class, Parent);

Make new Constructor with nested construction of a chain of prototypes hard relation of child constructor to parent constructor. The "super" defined from static method "_setSuper". If it absent Constructor lose ability call to Parent.

inherit._related(Child: Function, Parent: Function): Function
Parameters
Child (Function) constructor to extend
Parent (Function) constructor which will be installed as "super"
Returns
Function: constructor
Example
var inherit = require('s-inherit');
//
function Parent () { ... }
//
function Child ( data ) {
// Adding personal owned properties to the parent
this.superUniqueProperty.call(this, data);
// own properties of the constructor and/or overrides
this.props = 1;
}
Child._setSuper = function ( Parent ) {
this.superUniqueProperty = Parent;
}
// Constructor with nested construction of a chain of prototypes
var Inheritor = inherit._related(Child, Parent);

inherit.extend

Make new Constructor with nested construction of a chain of prototypes hard relation of child constructor to parent constructor. The "super" defined from static method "_setSuper". If it absent Constructor lose ability call to Parent context. No limit for nested construction of a chain of prototypes.

inherit.extend(Child: Function, Parent: Function, Parent: Function?): Function
Parameters
Child (Function) constructor to extend
Parent (Function) constructor which will be installed as "super"
Parent (Function?) constructor which will be installed as "super" as many times as you need
Returns
Function: constructor
Example
var inherit = require('s-inherit');
// it will give ability to combine inheritance any to any
function Parent1 () { ... }
Parent1._setSuper = function ( Parent ) { this.p1 = Parent; }
function Parent2 () { ... }
Parent2._setSuper = function ( Parent ) { this.p2 = Parent; }
function Parent3 () { ... }
Parent3._setSuper = function ( Parent ) { this.p3 = Parent; }
function Parent4 () { ... }
Parent4._setSuper = function ( Parent ) { this.p4 = Parent; }
//
function Child ( data ) {
// Adding personal owned properties to the parent
this.superUniqueProperty.call(this, data);
// own properties of the constructor and/or overrides
this.props = 1;
}
Child._setSuper = function ( Parent ) {
this.superUniqueProperty = Parent;
}
// Constructor with nested construction of a chain of prototypes
var Inheritor = inherit.extend(Child, Parent1, Parent2, Parent3, Parent4);

inherit.decorate

Make a new constructor using every transferred class and/or Object as decorator. Constructor steel have it own prototype, but have all own props from all decorators. Can be used as binded Constructor properties.

inherit.decorate(): Function
Returns
Function: constructor
Example
var inherit = require('s-inherit');
var DecoratedClass = inherit.decorate(Cube, {top: 100, left: 100}, {width: 100, heigh: 100, long: 100});

exports

defination on platforms (both variants on platform like Electron)

bower i --save s-inherit

npm i --save s-inherit

exports
Example
window.inherit                      // in browser
var inherit = require('s-inherit')  // in Node.js