@kingjs/create-constructor
v1.0.1
Published
Create a constructor from a base function and a body function.
Downloads
11
Readme
@kingjs/create-constructor
Usage
var createConstructor = require('@kingjs/create-constructor');
var Vehicle = createConstructor(
'Vehicle',
null,
function Vehicle(company, name) {
this.company = company;
this.name = name;
}
);
Vehicle.prototype.isVehicle = true;
var Car = createConstructor(
'Car',
Vehicle
);
Car.prototype.isCar = true;
var Truck = createConstructor(
'Truck',
Vehicle,
function(company, name, towingCapacity) {
this.towingCapacity = towingCapacity;
}
);
Truck.prototype.isTruck = true;
result:
API
declare function createConstructor(
): any
Parameters
Returns
Remarks
Install
With npm installed, run
$ npm install @kingjs/create-constructor
License
MIT