Inherit Multiple
Extends a child class by creating a prototype chain out of the base class(es)
Usage
Install
$ npm install inherit-multiple
Test
$ npm test
Document
$ npm run doc
Library
Modules
| Module | Description |
|---|---|
| inherit-multiple | Adds a prototype chain of all the base classes to a child class |
inherit-multiple
Adds a prototype chain of all the base classes to a child class
inherit-multiple~inheritMultiple
Creates a prototype chain from the super classes for the child class
as the prototype of the child class.(childClass, ...superClasses) ⇒ childClass
Returns: childClass - Returns the extended child class
| Param | Type | Description |
|---|---|---|
| childClass | function |
child class to extend |
| ...superClasses | function |
super classes to extend the child class with |
Example
function ChildClass(){}
function SuperClass(){}
SuperClass.prototype.method = function(){};
var inheritMultiple = require('inherit-multiple');
inheritMultiple(ChildClass, SuperClass, Array);
var instance = new ChildClass();