get-constructors - npm
get an array of constructors (classes) for objects and classes.
supports Google Chrome, Mozilla Firefox, Microsoft ie11/10/9/8/7/6 and Node.js/io.js.
INSTALL:
$ npm install get-constructors --save
or
http://lightspeedworks.github.io/get-constructors/get-constructors.js
PREPARE:
{ // you can use constructors}thisconstructors || ;
or
var constructors = thisconstructors || );
USAGE:
function: constructors(object or Class/constructor)
var constructors = ; ; // -> [Object]; // -> [Object, Function.prototype] ; // -> [Array, Object]; // -> [Array, Function.prototype] {}; // -> [Klass, Object]; // -> [Klass, Function.prototype] {}SubKlassprototype = ;SubKlassprototypeconstructor = SubKlass;SubKlasssuper_ = Klass; ; // -> [SubKlass, Klass, Object]; // -> [SubKlass, Klass, Function.prototype]
method: constructors.extendPrototype([ctor = Object])
Extends prototype method constructors
and returns constructors
.
Format
var constructors = ; {} // -> [Object]Object // -> [Object, Function.prototype] // -> [Array, Object]Array // -> [Array, Function.prototype] {} // -> [Klass, Object]Klass // -> [Klass, Function.prototype] {}SubKlassprototype = ;SubKlassprototypeconstructor = SubKlass;SubKlasssuper_ = Klass; // -> [SubKlass, Klass, Object]SubKlass // -> [SubKlass, Klass, Function.prototype]
method: this.constructors()
Get an array of constructor functions (classes). (after: constructors.extendPrototype())
Format
var constructors = ; {} {}MyClassprototype = MyClassprototypeconstructor = MyClass;MyClasssuper_ = BaseClass; var o1 = ;console; // -> true var classes = o1;console; // -> trueconsole; // -> trueconsole; // -> true
Returns
An array of constructor functions (classes).
method: Class.constructors()
Get an array of constructor functions (classes). (after: constructors.extendPrototype())
Format
var constructors = ; {} {}MyClassprototype = MyClassprototypeconstructor = MyClass;MyClasssuper_ = BaseClass; var classes = MyClass;console; // -> trueconsole; // -> trueconsole; // -> true
Returns
An array of constructor functions (classes).
SEE ALSO:
base-class-extend - npm
LICENSE:
MIT License